# Client connection pooling functioning

**URL:** <https://discuss.aerospike.com/t/client-connection-pooling-functioning/4818>\
**Category:** Client Libraries\
**Created:** [December 13, 2017, 1:40pm UTC](https://discuss.aerospike.com/t/client-connection-pooling-functioning/4818 "2017-12-13T13:40:20Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sujeet\_Jaiswal](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.aerospike.com/sujeet_jaiswal/32/1398_2.png) [@Sujeet\_Jaiswal](https://discuss.aerospike.com/u/Sujeet_Jaiswal)\
**Post date:** [December 13, 2017, 1:40pm UTC](https://discuss.aerospike.com/t/client-connection-pooling-functioning/4818/1 "2017-12-13T13:40:20Z")

</div>

- Does aerospike client provides connection pooling? Can application set pooling params?

- We have observed lot of new connections open and close based on read/write load. Does aerospike optimize by reusing existing free connection or it creates new connection for every read/write query?

---

<div class="post-metadata">

**Author:** ![Sujeet\_Jaiswal](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.aerospike.com/sujeet_jaiswal/32/1398_2.png) [@Sujeet\_Jaiswal](https://discuss.aerospike.com/u/Sujeet_Jaiswal)\
**Post date:** [January 3, 2018, 6:22am UTC](https://discuss.aerospike.com/t/client-connection-pooling-functioning/4818/2 "2018-01-03T06:22:06Z")

</div>

Can anyone throw some light on this?

---

<div class="post-metadata">

**Author:** ![kporter](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.aerospike.com/kporter/32/515_2.png) [@kporter](https://discuss.aerospike.com/u/kporter)\
**Post date:** [January 3, 2018, 7:27am UTC](https://discuss.aerospike.com/t/client-connection-pooling-functioning/4818/3 "2018-01-03T07:27:02Z")

</div>

Yes, some of the clients use connection pools and there are parameters for them.

Yes, the clients try to reuse sockets.

Which client are you using?

---

<div class="post-metadata">

**Author:** ![Sujeet\_Jaiswal](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.aerospike.com/sujeet_jaiswal/32/1398_2.png) [@Sujeet\_Jaiswal](https://discuss.aerospike.com/u/Sujeet_Jaiswal)\
**Post date:** [January 3, 2018, 10:40am UTC](https://discuss.aerospike.com/t/client-connection-pooling-functioning/4818/4 "2018-01-03T10:40:21Z")

</div>

We are using nodejs client and are planning to use java client as well in some upcoming projects. In our current prod with nodejs client, we see lots of sockets being opened/closed and the number grows multifold as the traffic increase. We were hoping for sockets being reused in our prod but it’s not noticeable.

---

<div class="post-metadata">

**Author:** ![rbotzer](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.aerospike.com/rbotzer/32/2114_2.png) [@rbotzer](https://discuss.aerospike.com/u/rbotzer)\
**Post date:** [January 3, 2018, 7:41pm UTC](https://discuss.aerospike.com/t/client-connection-pooling-functioning/4818/5 "2018-01-03T19:41:05Z")

</div>

Take a look at the Node.js client’s [documentation](https://www.aerospike.com/apidocs/nodejs/index.html) regarding [managing connections in a Node cluster](https://www.aerospike.com/apidocs/nodejs/tutorial-node_clusters.html). I suggest you open up an [issue](https://github.com/aerospike/aerospike-client-nodejs/issues) with the `aerospike/aerospike-client-nodejs` repo on Github if you’re running into problems with it.

---

<div class="post-metadata">

**Author:** ![Jan](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.aerospike.com/jan/32/1124_2.png) [@Jan](https://discuss.aerospike.com/u/Jan)\
**Post date:** [January 4, 2018, 8:03am UTC](https://discuss.aerospike.com/t/client-connection-pooling-functioning/4818/6 "2018-01-04T08:03:15Z")

</div>

The Node.js client does use connection pooling. It maintains a separate connection pool for every node in the cluster. The [`maxConnsPerNode`](https://www.aerospike.com/apidocs/nodejs/Config.html#maxConnsPerNode) configuration parameter controls the max. size of the connection pool.

The client also maintains separate (per-node) connection pools for certain operations like queries, scans, legacy batch direct operations (batchGet/batchExists/batchSelect commands) and info commands.
