You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I recently looked at my colleague's code, he used an connection pool to maintain over handreds gohbase clients.
After a little dig into gohbase code, it seems like gohbase client support concurrency.
So i want to know, what is the best practice, should we reuse one client or maintain an client pool.
The text was updated successfully, but these errors were encountered:
Yes, gohbase is concurrency safe. Reusing one client is the recommended way for multiple reason:
less connections to regionservers
less lookup to the meta table (since there is one cache per client)
better batching of RPCs. The client automatically batches RPCs per regionserver (default value https://github.com/tsuna/gohbase/blob/master/client.go#L25-L26) even if the client doesn't expose the batching mechanism. The recommended way right now is to start for example 100 goroutines doing .Put at the same time, they will all get batched automatically together (because the RS will reach the max queue size or the flush interval) and the reply will be handled to each call individually.
It's possible that to obtain a specific throughput, one may need a pool of clients, but I wouldn't expect that number to be in the hundreds. If you have some target req/s, it could be interesting to benchmark. We haven't benchmarked gohbase in a long time.
I recently looked at my colleague's code, he used an connection pool to maintain over handreds gohbase clients.
After a little dig into gohbase code, it seems like gohbase client support concurrency.
So i want to know, what is the best practice, should we reuse one client or maintain an client pool.
The text was updated successfully, but these errors were encountered: