phoenix-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Justin Workman <justinjwork...@gmail.com>
Subject Long DB Connect Times
Date Thu, 06 Feb 2014 18:04:13 GMT
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();

Mime
View raw message