![](https://csdnimg.cn/release/download_crawler_static/6430827/bg10.jpg)
Introduction to Couchbase Server
6
Smart clients discover changes in the cluster using the Couchbase Management REST API. Buckets can be used to isolate
individual applications to provide multi-tenancy, or to isolate data types in the cache to enhance performance and visibili-
ty. Couchbase Server allows you to configure different ports to access different buckets, and gives you the option to access
isolated buckets using either the binary protocol with SASL authentication, or the ASCII protocol with no authentication
Couchbase Server allows you to use and mix different types of buckets (Couchbase and Memcached) as appropriate in
your environment. Buckets of different types still share the same resource pool and cluster resources. Quotas for RAM and
disk usage are configurable per bucket so that resource usage can be managed across the cluster. Quotas can be modified
on a running cluster so that administrators can reallocate resources as usage patterns or priorities change over time.
1.3.5. vBuckets
A vBucket is defined as the owner of a subset of the key space of a Couchbase cluster. These vBuckets are used to allow
information to be distributed effectively across the cluster. The vBucket system is used both for distributing data, and for
supporting replicas (copies of bucket data) on more than one node.
Note
vBuckets are not a user-accessible component, but they are a critical component of Couchbase Server
and are vital to the availability support and the elastic nature.
Every document ID belongs to a vBucket. A mapping function is used to calculate the vBucket in which a given document
belongs. In Couchbase Server, that mapping function is a hashing function that takes a document ID as input and outputs
a vBucket identifier. Once the vBucket identifier has been computed, a table is consulted to lookup the server that "hosts"
that vBucket. The table contains one row per vBucket, pairing the vBucket to its hosting server. A server appearing in this
table can be (and usually is) responsible for multiple vBuckets.
The hashing function used by Couchbase Server to map document IDs to vBuckets is configurable - both the hashing algo-
rithm and the output space (i.e. the total number of vBuckets output by the function). Naturally, if the number of vBuckets
in the output space of the hash function is changed, then the table which maps vBuckets to Servers must be resized.
1.3.6. Disk Storage
For performance, Couchbase Server prefers to store and provide all the information to clients using RAM. However, this
is not always possible or desirable in an application. Instead, what is required is the 'working set' of information stored in
RAM and immediately available for supporting low-latency responses.
Couchbase Server provides support for storing document on disk. This is provided for a number of reasons:
• Persistence. Couchbase can be loaded with data, shutdown, and started up again without the data having to be re-loaded
from another source. In this way, Couchbase Server more than simply a caching layer on top of an existing database in-
frastructure.
• Faster warm-up times. Other the lifetime of Couchbase Server node there may be soft or hard failures and regular ad-
ministration tasks that need to take place. By storing information on disk, when you start-up your Couchbase Server
node the data can be loaded to 'warm-up' the database with the active dataset so that it can start serving requests for data
as quickly as possible.
• Disk storage enables you to store datasets larger than the physical RAM size. Couchbase automatically moves data be-
tween RAM and disk (asynchronously in the background) in order to keep regularly used information in memory, and
less frequently used data on disk.
The process of moving data from RAM to disk is called eviction, and is configured automatically through thresholds set
on each configured bucket in your Couchbase Cluster.
The use of disk storage presents an issue in that a client request for a document ID must know whether the information ex-
ists or not. Couchbase Server achieves this using metadata structures. The metadata holds information about each docu-