Re: Re: managing HConnection

2015-02-16 Thread Serega Sheypak
Newrelic shows 50K RPM each request to servlet == 1-3 put/get to HBase. I have mixed workload. Is it strange :) ? 2015-02-16 10:37 GMT+03:00 David chen c77...@163.com: 5 rpm? I am curious how the result is concluded?

Re: Re: Re: managing HConnection

2015-02-15 Thread Serega Sheypak
I don't understand you. There is a single instance of servlet per application. Servlet.init method called once. Here you can instantiate HConnection and solve ANY concurrency problems. HConnection is tread-safe. Just don't close it and reuse. Then just use HConnection to get HTable. What problem

Re: Re: Re: managing HConnection

2015-02-15 Thread Sleiman Jneidi
That's true, we can share the connection, but the problem is, HConnection implements Closeable, and hence its close method is public. If you share the same connection in your api, you always have to check if the current connection is closed before you return it to the client, check previous

Re:Re: Re: Re: managing HConnection

2015-02-15 Thread David chen
Sorry for the unclear represent. My problem is that whether or not a sharing Honnection can bear too many query requests?

Re: Re: managing HConnection

2015-02-13 Thread Serega Sheypak
Hi, really, I can share one Hconnection for the whole application. It's done by design. I have several servlets. Each servlet has 1-2 controllers working with hbase internally (put/get/e.t.c) Right now I don't see any reason to refactor code and share single HConnection for all controllers in

Re: Re: managing HConnection

2015-02-13 Thread Sleiman Jneidi
To be honest guys I am still confused, especially that that HConnection implements Closeable and hence everyone has the right to close the connection. I wrote this code to manage connections but I am not sure about its correctness. private static class HConnectionProvider { private static

Re: Re: managing HConnection

2015-02-13 Thread Serega Sheypak
What are you trying to achieve? 2015-02-13 12:36 GMT+03:00 Sleiman Jneidi jneidi.slei...@gmail.com: To be honest guys I am still confused, especially that that HConnection implements Closeable and hence everyone has the right to close the connection. I wrote this code to manage connections

Re: Re: managing HConnection

2015-02-13 Thread Sleiman Jneidi
a single HConnection On Fri, Feb 13, 2015 at 11:12 AM, Serega Sheypak serega.shey...@gmail.com wrote: What are you trying to achieve? 2015-02-13 12:36 GMT+03:00 Sleiman Jneidi jneidi.slei...@gmail.com: To be honest guys I am still confused, especially that that HConnection implements

Re: Re: managing HConnection

2015-02-13 Thread Serega Sheypak
What's the problem to call HConnectionManager.getConnection in Servlet.init method and pass it to your class responsible for HBase interaction? 2015-02-13 14:49 GMT+03:00 Sleiman Jneidi jneidi.slei...@gmail.com: a single HConnection On Fri, Feb 13, 2015 at 11:12 AM, Serega Sheypak