Request and Connection model

What is the model of Couchbase requests? Is it a simple request-response? or pipeline? or multiplexing and non-blocking I/O?
What about connection pooling? What is the default max-connection in the pool and how can I change it, Can you please tell me more details, like when the connection is disposed, how multiple node managed

Hey @socketman2016 ,

There is a lot of complexity to the way that Couchbase handles its connections with the nodes, and it depends what service we are talking about. It’d be helpful to understand what you are trying to solve so I can try to give better answers in the context of your problem. I’ll try to address your specific questions below though:

Is it request-response?
Most of the KV protocol is request-response based, most of the non-KV services are also request-response. KV uses a push-based system for some things though, such as synchronous durability as well as certain kinds of streaming.

Or pipeline?
We do use pipelining to improve performance. It’s possible that many requests are sent in a row before responses are received.

or multiplexing?
We do support the use of multiple connections to each node, and we additionally maintain at least 1 connection per node. Requests are multiplexed both ways, they are distributed to the appropriate node, and we also load balance across the connections we have to any particular node.

non-blocking I/O?
We use non-blocking IO when possible (we use libuv in Node.js, which is a non-blocking library).

connection pooling?
Most of the SDKs support connection pooling for KV although the Node.js SDK does not, as the performance of libuv and pipelining / multiplexing has negated the need for it. We do use connection pools for HTTP connections to non-KV services though.

when the connection is disposed
Connections are disposed of when the cluster object is closed in the Node.js SDK. The underlying libuv bindings do not provide enough context to enable connections to be automatically disposed when no longer in use, though this is a goal for the future.

how multiple node managed
We maintain one persistent connection for KV to each node. We receive cluster topology updates from nodes in a round-robin fashion and use this to send requests to the appropriate nodes.

1 Like

@brett19 I have no problem now, It’s just a question, I want to know more about internal features of couchbase
Is there any document or article?