phoenix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From William <yhxx...@163.com>
Subject Re:JDBC Connection time
Date Wed, 03 Aug 2016 13:22:56 GMT
It will cost that much indeed. If you connect to an HBase cluster with HBase native API, it
will cost that much too.
But this is only for the 'first' connection in current JVM process. You can modify your test
code and check how long it takes for the second or third connection.
It will be less than 1 ms as phoenix connection is designed to be light weight and all connections
that connected to the same hbase cluster will share 
the same low-level hbase connection.  


I hope this will help you out.


William.

At 2016-08-03 12:11:42, "김민석" <corekms@gmail.com> wrote:
>Hello All,
>I'm writing my own java source using JDBC to test my own scenario/
>
>import java.sql.*;
>import java.util.*;
>
>public class phoenixTest {
>  public static void main(String args[]) throws Exception {
>    Connection conn;
>    //Properties prop = new Properties();
>    Class.forName("org.apache.phoenix.jdbc.PhoenixDriver");
>    long startTime = System.currentTimeMillis();
>    conn =
> DriverManager.getConnection("jdbc:phoenix:localhost:2181:/hbase");
>    long estimatedTime = System.currentTimeMillis() - startTime;
>    System.out.format("got connection : %s ms\n",
>Long.toString(estimatedTime));
>    //System.out.format("got connection : %s \n", "test");
>  }
>}
>
>The result of the source above...
>log4j:WARN No appenders could be found for logger
>(org.apache.hadoop.conf.Configuration.deprecation).
>log4j:WARN Please initialize the log4j system properly.
>log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for
>more info.
>got connection : 3162 ms
>
>It takes over 3 seconds to create the new connection. Is it normal?
>Can it be handled through connection pool in application server?
>
>Any advice would be appreciated. Thanks in advance.
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message