-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HBase client should use a single Connection object #322
Comments
In the current core/Client.java code, _db.cleanup() is called on each thread which prevents from having a single DBs connection object across multiple threads. This prevents DB like If we move out the logic to call the cleanup() method after all the thread execution in Client.java here, then DBs like Note that the quick hack referred in the write-up is to make the conversation easier. |
@busbey . Regarding your query about stats from using single hbase connection and multi-connections in PR #591 , here are some from hbase10 load and run with 10 threads and 1 million recordcount/operation count. The test was run on a 4 RS VM cluster with hbase 0.98 on it.
|
I believe what you are asking for can be done without updating core code. You can look at the Cassandra binding as an example as it is using a single database connection instance. It keeps track of the number of init() calls so that in the cleanup(), it closes the connection on the last thread. While I'm not opposed to updating core code in general and I do find you solution elegant, I like the current method as it allows the DB binding implementer to choose the most appropriate style for their particular database. My 2 pennies. |
Thanks @cmatser for your comments. The thought was that if all the DBs/datastores supported will benefit from the change in the core, it will help by not including the logic individually to use single connection. Since it may not be the case, will include the logic in |
Fixed in #591 |
per the javadocs for HBase Connection, we should be making and sharing a single Connection for the application and then creating Table instance per DB instance. As is, we create a ZK connection per thread and tons of threads.
The text was updated successfully, but these errors were encountered: