aerospike-client-csharp icon indicating copy to clipboard operation
aerospike-client-csharp copied to clipboard

Cluster.Run on the thread pool

Open verdie-g opened this issue 1 year ago • 1 comments

https://github.com/aerospike/aerospike-client-csharp/blob/ba6b5a6b422bc7b0992f9eeb761db94c8f2085ba/AerospikeClient/Cluster/Cluster.cs#L301

Currently, Cluster.Run is executed on a dedicated threads. This is not great for several reasons:

  1. it's a inefficient use of resource, especially when the application is connected to many clusters
  2. it involves extra context switches
  3. when investigating thread pool starvation, a trace could show that Cluster.Run was the method that spent the most time blocking threads. After some time, you realize that it's a in dedicated thread so it can be ignored for the investigation. image

What do you think about making the Aerospike client a good citizen by turning this code async and running it in the thread pool?

verdie-g avatar May 28 '24 16:05 verdie-g

I am in the process of changing the client to be async awaitable. I will keep your concerns in mind when I revisit the tendThread and Cluster.Run.

shannonklaus avatar May 31 '24 17:05 shannonklaus