Book Image

Couchbase Essentials

Book Image

Couchbase Essentials

Overview of this book

Table of Contents (15 chapters)
Couchbase Essentials
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

RAM matters


Couchbase is a "RAM first, disk second" database. Both the reads and writes are optimized to use RAM. On the write side, documents are written to the memory first and then flushed asynchronously to the disk. While volatile memory might not seem optimal for a database, remember that Couchbase will replicate your data on up to three nodes. Additionally, there are API methods that require a disk write before a write to RAM is considered a success.

On the read side, Couchbase maintains metadata about documents in the RAM to provide faster retrieval. Couchbase will also attempt to store as many documents as it is able to in the memory for faster access. Less available RAM means that Couchbase will need to fetch more documents from the disk. Couchbase uses a most recently used (MRU) algorithm to determine which documents are cached and which are evicted. The current beta version, Couchbase Server 3.0, will allow caching and eviction strategies to be tuned.