Aerospike eventloops passed to client policy and each call?


#1

the new async API enables to set an external EventLoops instance… but it requires a specific EventLoop instance on each call execution… am I missing something? why do I need to/can set both?


#2

EventLoops are set on AerospikeClient instantiation because the client needs to create event loop wrappers that conform to the Aerospike EventLoop interface when Netty is used. EventLoops are also set to notify the client to initialize internal structures related to async processing.

Each call execution requires an EventLoop instance because it gives the user control over which event loop processes the command. This is very useful if you need to run a set commands that interact with each other. If you run this set of commands on the same event loop, the callback code does not have to be thread-safe and will be more efficient.

To randomly distribute commands across event loops, pass in EventLoops.next() as the EventLoop instance.