Writing Multi-threaded application


Hi All,

I am integrating aerospike with our multithreaded application(using C++). Every time opening & closing connection to aerospike clusters are expensive.

So can i create a connection once in a application and call read/write operations from multiple threads?Is it thread safe? or do i need to create connection pool?

Regards, Rayappan A



Aerospike’s clients are built to use multithreading.

In the C client, you’ll want to create a single connection object (AerospikeClient object). This object contains all the information about the server’s data layout (the current consistent hash layout), and contains connection pools.

Therefore, you should create one AerospikeClient object and share it among the threads accessing the cluster.