Very frequent couchbase document updates

I'm new to couchbase and was wondering if a very frequent update of one document (maybe every second) could all updates go through the write queue to disk, or just the last update made to the document?

In other words, couchbase optimizes disk writes by only writing the document to disk once, even if it refreshes multiple times between writes.

Based on the docs http://docs.couchbase.com/admin/admin/Monitoring/monitor-diskqueue.html it looks like all updates have been processed. If anyone can confirm this, I would be grateful.

thank

+3


source to share


2 answers


Updates are stored in a disk queue before being written to disk. If there is a write to a document and the previous write is still queued to disk, then the two entries will be merged and only the latest version will actually be written to disk.



Exactly how fast the drains in the disk queue will depend on the storage subsystem, so whether or not a write to the same get coalesced key will depend on how fast the writes are, compared to the speed of the storage subsystem / node.

+4


source


Jako, you should be more worried about updates happening in milliseconds or more than one update happening within 1 (one) millisecond. Writing to disk is not a problem, Couchbase solves this intelligently on its own, but the fact that you will concurrency exit when you are running in milliseconds.

I ran into them quite easily when I was testing my application and at first couldn't figure out why Node.js (in my case) would sometimes write data to CouchBase and sometimes not. If it didn't write to CouchBase, usually for the first write.



More problems with first checking if there was a document with a specific key, after I was not existing, I would try to write it to CouchBase only to find out that an early callback was completed in the meantime and now there really was a key for the same document.

In this case, you have to work with the CAS flag and program it iteratively so that your application constantly tries to pull out the correct document for that key and then update it. Keep this in mind, especially when running tests and updates in the same document!

0


source







All Articles