A good one for you HBase committers to help with. I'd appreciate it if
folks could subscribe to the user group and help answer questions. My model
for excellence here is based off of what I've seen in the HBase community
which is absolutely fantastic.
Thanks!
James

---------- Forwarded message ----------
From: Justin Workman <[email protected]>
Date: Thu, Feb 6, 2014 at 10:04 AM
Subject: Long DB Connect Times
To: "[email protected]" <[email protected]>


I am using this following java code to make my DB connection and I am
seeing what seems like long connect times to the database. We see similar
connect times opening a connection with sqlline. Are there any options to
speed up the connection? The query is returning in roughly 500-700ms once
the connection is made.

Timing of the Java client around the db connection statement
DB Connection Time: 17.09 s
DB Connection Time: 6.888 s
DB Connection Time: 2.007 s
DB Connection Time: 6.894 s
DB Connection Time: 12.05 s

This is all running the same query, and reconnecting to the DB everytime.
We are using Kerberos, but I am starting my timer after authenticating.

Sample code

*DB Connection:*
public static Connection getPhoenixConnection() throws Exception {
    Class.forName("com.salesforce.phoenix.jdbc.PhoenixDriver");
    String connectionURL = "jdbc:phoenix:" + zkQuorum;
    LOGGER.warn("Making Phoenix Connection Now To Zookeeper: " + zkQuorum);

    Connection r = DriverManager.getConnection (connectionURL);
    r.setAutoCommit(true);
    return r;
  }

*Call to connect to DB:*
UserGroupInformation ugi =
UserGroupInformation.loginUserFromKeytabAndReturnUGI(RUNTIME_USER,
KEYTAB_PATH);
    LOGGER.info("Logged in from keytab as: " + ugi.getUserName());
    // Create connection as privileged user
    Stopwatch connectionTimer = new Stopwatch().start();
    conn = ugi.doAs(new PrivilegedExceptionAction<Connection>() {
        public Connection run() throws Exception {
           try {
              conn = getPhoenixConnection();
           } catch (Exception e) {
              LOGGER.warn("Failed to make secure Phoenix connection. " + e);
              throw e;
           }
           return conn;
        }
     });
    connectionTimer.stop();

Reply via email to