Couchbase Workflow

I am new to using Couchbase and I want to ask a question about the Couchbase workflow.

I put many items in a Couchbase data bucket (not memcached). Is it right that these items will be in the data bucket before the expiration time? And when it is reached, Couchbase will not delete them automatically. Actual deletion of an element will occur only if the client requests this element. In this case, Couchbase realizes that the item has expired, returns null, and removes the item from memory.

This is important to me because it greatly affects how my decision understands an element that is not in the cache. If everything works as I think, then the element is absent only if it has not been cached or expired or it was in memory, and the server was rebooted. And Couchbase will always put the item in the cache, even if there is no free memory on the left: it will just put it on the hard drive, right?

What happens to items stored on the hard disk due to lack of RAM if the server was rebooted? Will they also be erased?

+4
source share
1 answer

As you said, the data will remain in Couchbase until the expiration date: - if the expiration time is set to 0: the data will remain until the application calls the delete () operation - if the expiration time is set to X: the data will remain in Couchbase until X (second) is reached, and the Couchbase server automatically invalidates and deletes the value.

I don’t understand why you say: “And when it is reached, Couchbase will not delete them automatically”, Couchbase automatically deletes the expired element: either when trying to access the expired element or its own internal process, see http: // www. couchbase.com/docs/couchbase-devguide-2.0/about-ttl-values.html

So, you are right when you say that you will have a “not_found” only when the key does not exist (never created or deleted from Couchbase automatically or using explicit delete ())

Couchbase will place the item first in RAM and write it to disk. Couchbase is responsible for managing memory and best retains the most used element in memory. Thus, you can obviously manage more data than the amount of your RAM, you just need to work with good balance in order to have good characteristics and avoid I / O.

When the server restarts, Couchbase has all the data on the disk and at startup it fills the memory with keys and metadata. Therefore, you are not losing anything.

I invite you to read these interesting articles / documents on the Couchbase architecture: - http://www.couchbase.com/docs/couchbase-manual-2.0/couchbase-introduction-architecture.html - http://horicky.blogspot.fr/ 2012/07 / couchbase-architecture.html

Let me know if you need more information.

Tag

+4
source

Source: https://habr.com/ru/post/1445449/


All Articles