When I write 1000 data items into the couchbase server,
I deliberately remove a node with “service couchbase-server stop” .
After successful autofailover, I meet a problem with data loss.
And meaningfully I find the writing speed slows down, and even time-ou Exception occurs frequently.
Do not use latches, use .toBlocking to convert your observable into a Blocking one and then call .single(), .forEach() and so forth on it
Make sure that when you retry your observable is cold, either by using Observable.from(doc) and then flatmap the insert or use Observable.defer() and wrap the insert call with it.
I don’t know your actual numbers, but keep in mind that when you failover you have one node less in the cluster to handle your requests, but it should be able to withstand it more or less closely.
Can you share some actual numbers that you are seeing?
toBlocking() should not be used with the retry builder since it’s async at this point, but downstream the observable you can block, finally if you want to.
So you are performing a bulk import? Or is it part of a OLTP appplication - this changes the retry semantics quite a bit because you mostly can accept longer delays on latency and go for max throughput (in the bulk case).
@xiger are you able to share the full code to reproduce with some logs and more? So we can have an accurrate reproduction case here and help you moving forward.
we havenot use the couchbase server in the web app.
we used the memcahed server to store the data to support the speed of the process of parsing and verfying of the file uploaded, and now as of memcahed’s bad avaliablity, we use couchbase server to replace the memcached.
because data changes in time, we also do the data syn.
And out storage environment: sqlserver and memcached.–subsequently---->sqlserver and couchbase server
@xiger the toBlock is more efficient in a way that you can do much more with it. the latch works fine for a single result, but it gets more tricky if you are iterating over the results in a blocking fashion. Also, it’s idiomatic RxJava code. You don’t need to stick to it but it’s recommended.
when I deal with the node failure excpetion in coding, and while using .toBlock() to retrive the data without timeout,i cannot utilize the retry builder, but how can i catch the excpetion to retry the CRUD operation.