High time out rate with C client

query

#1

Hi Aerospike Community,

I am testing out Aerospike C client for Windows. The old client is the libevent client mentioned in Aerospike page:

https://www.aerospike.com/docs/client/libevent/index.html

The new client being integrated is the asynchronous C libevent:

https://www.aerospike.com/docs/client/c/index.html

Test is performed on a server that makes 1400 asynchronous get requests to Aerospike cluster of 5 nodes.

The old client is consistently timing out at less than 1% of total request.

The new client is consistently timing out at around 5% of total request.

What is the reason of this high time out rate? Does the way I use the clients produce different requests to the server?

Snippet of old client usage:

uint32_t requestTimeoutMs = 10;

int ret = ev2citrusleaf_get(cluster, nameSpace, setName, &key, binNames, 1, requestTimeoutMs, GetCallBack, (void*)udata, eventLoop);

Snippet of new client usage:

as_event_create_loops(1);//called during client construciton

uint32_t requestTimeoutMs = 10;

as_policy_read readPolicy; 
as_policy_read_init(&readPolicy);
readPolicy.base.total_timeout = requestTimeoutMs;

int ret = aerospike_key_select_async(cluster, &err, &readPolicy, &key, binNames, GetCallBack, (void *)udata, nullptr, nullptr);

#2

The old Aerospike libevent client does not support initiating a command on a different thread from the event loop thread. If you do use a different thread, corruption will occur. Therefore, I assume your old client command example is running completely on the event loop thread (fast).

The new C client does support initiating a command on a non event loop thread. Your example is doing exactly that. as_event_create_loops(1) creates a separate event loop thread from your main thread. The command is then initiated from the main thread which means the command is passed in a thread-safe queue (locks involved) to the event loop thread. This will run slower.

Your new client example needs to be rewritten to run the get requests on the event loop thread.

  • Run the first command in the same way you do now.
  • The chosen event loop is passed to your callback from that event loop’s thread.
  • Use that event loop in your callback to issue the remaining get requests (or a block subset of requests if you need to conserve sockets).

The C async tutorial demonstrates how to run blocks of async commands on the event loop thread.

https://www.aerospike.com/docs/client/c/usage/async.html


#3

Hi Brian,

I did the three steps you mentioned, the time out rate is still the same.


#4

I would need to see complete source code for both old and new client benchmark to analyze further.