官术网_书友最值得收藏!

Couchbase SDKs

We'll explore the Couchbase SDK and relevant APIs in detail over the next few chapters. But to complete our discussion on balancing and rebalancing, it's useful to understand the process from client to cluster. When an SDK is initialized in a client application, it makes a persistent connection to the cluster over a RESTful API. This API broadcasts a JSON message containing the cluster's topology. As nodes are added or removed, the cluster sends a new message with an updated topology.

This behavior sets Couchbase apart from other databases, whether relational or nonrelational. Most database systems have a central point of communication that is responsible for client communications. Couchbase owes some of its massive throughput to its smart clients. Eliminating the bottleneck of a man-in-the-middle allows performance levels to reach a massive scale. On a cluster with only four nodes, Couchbase is capable of achieving nearly 1 million operations per second.

Returning to the idea of balancing data across nodes, there's an additional detail that I didn't mention. The cluster maintains an abstraction known as vBuckets, which are used to direct a key to the correct server. Rather than mapping a key directly to a node, Couchbase SDKs map the key to one of the vBuckets. The endpoint for a vBucket is provided to the client as part of its topology message from the cluster. Regardless of the number of nodes, the number of vBuckets remains the same. The keys always hash to the same vBucket, even if the cluster changes the endpoint of the vBucket.

While you'll generally not need to worry about the existence of vBuckets, it is important to understand what happens on the client as the cluster changes its topology. The client maintains a map of vBuckets to the nodes. If that map changes due to a node failure, brief client failures may appear while the map is updated.

Tip

The only case where you're likely to care about vBuckets is if you are developing an application using Mac OS X. On this platform, Couchbase Server uses 64 vBuckets instead of the standard 1024. While this difference generally won't impact your development, it will impede your ability to move data from your local server to another cluster running Linux or Windows.

主站蜘蛛池模板: 玛曲县| 沿河| 广汉市| 乌恰县| 增城市| 芷江| 运城市| 应城市| 墨玉县| 泾川县| 高邑县| 东丽区| 遵化市| 井陉县| 鄯善县| 灵寿县| 栾城县| 永善县| 贵阳市| 平利县| 定州市| 莎车县| 瓮安县| 新化县| 东丰县| 洪洞县| 班戈县| 太康县| 福安市| 江源县| 聊城市| 哈尔滨市| 土默特左旗| 清苑县| 芜湖县| 鹰潭市| 安龙县| 隆回县| 张掖市| 错那县| 南投市|