Search code examples
couchbase

Couchbase buckets vs Ephemeral buckets


Is Couchbase buckets store data in memory too? I want to create live leaderboard system using Couchbase buckets and I run four different queries :

1- select existed rank
2- update rank if existed (rank + 1)
3- insert rank and more data if not existed (rank = 1)

4- select from collection using limit 10 and order by rank desc.

I will be happy to listen to your suggestions to get best performance from Couchbase. In this situation is there any difference using Normal Couchbase bucket or using Ephemeral buckets ?

I try to read Couchbase document Couchbase Docs it's very good but I want to know more and use people experiences.


Solution

  • To answer the question "Does Couchbase buckets store data in memory too?" the answer is yes. Couchbase buckets are memory-first, mutations are queued up asynchronously to be written to disk.

    Ephemeral buckets are memory-only. Meaning there is no queue to write mutations to the disk.

    As for "best performance", that's really not a great question for Stack Overflow. You might consider the Couchbase forums or the Couchbase Discord to get some more opinions.

    In general, Ephemeral will almost always be (at least slightly) faster than Couchbase buckets, and for the most part they have the same capabilities.

    However, Ephemeral durability is only provided via memory on other nodes. If a whole cluster goes offline, and the data is not backed up or replicated elsewhere, that data might be lost forever (hence the name). So, I personally would only recommend Ephemeral if you want to optimize for pure performance and having memory-only durability is an acceptable trade-off.