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