accumulo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Corey Nolet <cjno...@gmail.com>
Subject Re: Query Services Layer Question
Date Tue, 20 May 2014 02:42:59 GMT
Jeff,

Unless you've got multiple different tables with different permissions to
manage for different physical Accumulo users, the connector should probably
be an instance variable in your service. It can be safely shared across all
the reads as long as the Accumulo user configured in the connector has
enough permissions to see what the users of your service need to see. The
communication with the tablet servers doesn't happen until the scanner
creation factory methods are called on connector and an iteration has been
initiated over the them.


On Mon, May 19, 2014 at 10:29 PM, Jeff Schwartz <abigbearsfan@gmail.com>wrote:

> Rookie Question...  I've built a Query Service Layer (QSL) according to
> the documentation from the Accumulo v1.6.0 User Manual.  My question is how
> often should I be getting a Zoo Keeper Instance and Connector to accumulo.
>  For example, here's some psuedo code for a typical service in my QSL.
>
> public void readTable(...) {
>     Instance instance = new ZooKeeperInstance(accumuloInstanceName,
> zooServers);
>     Connector connector = instance.getConnector(username, passwordToken);
>     Scanner scanner = connector.getScanner(tableName, auths);
>     Scanner.setRange(range);
>     for (Map.Entry<Key,Value> entry : scanner) {
>       ...
>     }
>     scanner.close();
> }
>
> If I do these lines of code for every call in my restful service, then I
> feel like that is generating a lot of extra connections to both zookeeper
> and accumulo.  Additionally, I would assume that that will have a negative
> impact on performance.  Should I cache any connectors or ZooKeeper
> instances?
>
> Any suggestions or best practices would be greatly appreciated.
>
> Thanks in advance.
>
> Sincerely,
> Jeff Schwartz
>

Mime
View raw message