You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hbase.apache.org by Jim Hughes <jh...@ccri.com> on 2020/02/13 16:53:35 UTC
Best practices for stopping Coprocessor calls/scans in client code
Hi all,
I work on GeoMesa which uses HBase to store geospatial data. One of our
uses patterns to use GeoMesa+HBase client code in a web tier to respond
to ad hoc user queries. Those web requests are translated to HBase
coprocessor calls or HBase Scans.
For this use case, we want to manage the number of threads and time that
those threads can use for any given request. Concretely, we may want a
particular deployment to 'time out' requests after 60 seconds.
With that in mind, I have two broad questions:
1. Are there example open source code samples which show ways to the
HBase client in this manner? (For instance, has Apache Phoenix already
solved this problem. I kinda tried to look at that code base for ideas.)
2. Is there an expected / documented pattern which would let me solve
this problem well?
In terms of the second question, I have seen that the HTableInterface
has a getTable(TableName tableName, ExecutorService pool) method. One
solution is to pass in a new ThreadPool/ExecutorService per GeoMesa
request. When the GeoMesa timeout hits, we can cool shutdownNow.
This solution is 'correct' in that it achieves the desired timeout
behaviour. The downside is that it is slower than our previous code
which just fired off requests without a timeout capability.
Thanks in advance for any links, suggestions, positive feedback, etc!
Cheers,
Jim