Are connections in connection pool closed in Aerospike after we close the parent connection?

61 Views Asked by At

The ClientPolicy of the Aerospike connection I am creating has minConnsPerNode = 10. When I create a connection using the below syntax in C#

using (AerospikeClient client = new AerospikeClient(moduleClientPolicy, address, port))
{

}

Will the 10 connections that were created (due to minConnsPerNode) be closed after '}' or they will be moved back to connection pool?

If they are moved back to connection pool, the next connection I make again using the above syntax will use the connection from the pool right?

Also, is there a way to figure out the number of connections made with Aerospike?

2

There are 2 best solutions below

0
pgupta On BEST ANSWER

minConnsPerNode number of connections are kept open in the connection pool. If connections fall below that number, new ones are opened by the tend thread and put in the pool. This can happen if the the socket is closed, when used, in certain situations. When asking for a new connection, if there are connections in the pool, they are used. So, overall, your understandig about minConnsPerNode is correct. (Ensure, server uses proto-fd-idle-ms =0 [default] so connections are not closed by the server and then have to be re-opened by tend thread to maintain the minConnsPerNode. Server uses keep-alive messages to detect abandoned clients and close sockets.)

0
Roi Menashe On

I'm not sure about your question regarding the minConnsPerNode but as for your last question, how to figure out the number of connections made with Aerospike if you mean the number of connections currently open to Aerospike nodes then you can use asadm and specifically i net command will print information about Aerospike's networking, for example:

Admin> i net
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Network Information (2020-12-18 18:15:50 UTC)~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      Cluster|                          Node|         Node ID|             IP|     Build|Migrations|~~~~~~~~~~~~~~~~~~Cluster~~~~~~~~~~~~~~~~~~|Client|  Uptime
             |                              |                |               |          |          |Size|         Key|Integrity|      Principal| Conns|        
bob-cluster-a|  10-0-0-1.heln.qwest.net:3000| BB9010016AE4202|  10.0.0.1:3000|E-4.9.0.18|   0.000  |   2|C3F2BCB417C3|True     |BB9020016AE4202|     4|00:04:59
bob-cluster-a|  10-0-0-2.heln.qwest.net:3000|*BB9020016AE4202|  10.0.0.2:3000|E-4.9.0.18|   0.000  |   2|C3F2BCB417C3|True     |BB9020016AE4202|     3|00:04:59
Number of rows: 2

Will show the number of current open connections for each node of the cluster under Client conns column.