How to set the ClientPolicy


What is the recommendation on how to set ClientPolicy e.g. maxThreads, timeout, maxSocketIdle, etc?

The client policy java doc is:

The synchronous AerospikeClient relies on the caller to generate threads, but AerospikeClient does need to create pools of sockets. Since we want 1 socket per thread (for a given node), maxThreads just sets a limit on the number of sockets in the pool. For performance reasons, you should avoid generating more threads than your specified maxThreads (default: 300).

ClientPolicy.Timeout (in milliseconds) is used as a socket connect timeout only (not a transaction timeout).

“maxSocketIdle” (seconds) defines how long a socket can sit idle in the connection pool. If the socket is idle for more than maxSocketIdle, it will be closed.

“failIfNotConnected” is used for app-server implementations that may start before the Aerospike server is started. If “failIfNotConnected” is false (default), no exception is thrown and the client will automatically connect when Aerospike server is available. If “failIfNotConnected” is true, an exception will be thrown immediately if Aerospike server is not available.

Aerospike recommends the defaults.