Is there logic in the client to connect to the nearest server?

For the multi AZ Aerospike deployment, is there logic in the client to prefer a closest server?

Hi likharev

Aerospike client connects with an Aerospike cluster using one or more seed IP addressed provided in client connect() call.

Probably the application could have this logic implemented and pass on the appropriate seed IP addresses to connect with Aerospike cluster.

-samir

samir,

my understanding that seed server(s) used to discover the topology, and technically speaking should not be used to make a call. Let me explain, in cloud environment I might have an array of the servers that form a cluster, much more preferable to have a LB that is used to node discovery , but not to do calls and actual call should be done to the set of the servers that were discovered.

Let me ask you, are you sure that seed servers are the first to make a connect?

Hi likharev,

I think what you are asking is if a single instance of AerospikeClient has the ability to automatically (by some clever criteria) connect to the “closest” cluster.

The answer is no. The AerospikeClient will connect to the Cluster specified by one or more seed nodes. The seed nodes must be part of the same cluster, not a list of clusters to connect to.

The client instance will attempt to connect to the first seed, if successful it will discover all the other nodes in the cluster, if unsuccessful, it will attempt to connect to the next seed, and so on. The default timeout time is 1000 ms, and this can be changed using a ClientPolicy.

Using a seed node list as a mechanism for selecting the closest cluster is fraught with uncertainty, as the mechanism is not designed to deal with multiple clusters.

You will need to implement the selection of a cluster in your application, this could be as simple as pinging a node in each of the clusters and taking the shortest response time, but you would have to prove a reliable algorithm, with no corner cases, yourself.

Finally, please, please do not put a load balancer between the AerospikeClient and the Cluster. Aerospike already load balances the requests to the cluster in the Aerospike smart client. Adding a load balancer will thwart the smart client, increase the network latencies and result in poor reliability and throughput.

I hope this helps.

Peter