Lucky, Thanks for the code. And what is the time for cache.query() for the same query?
Denis вт, 5 дек. 2017 г. в 11:25, Lucky <[email protected]>: > Denis, > The code is here: > public static void main(String[] args){ > try { String sql = "SELECT \"T0\".\"FID\" AS \"ID\", > \"T0\".\"FCUSTOMERGROUPSTANDARDID\" AS \"T1.ID\", > \"T0\".\"FCUSTOMERGROUPID\" AS \"T2.ID\", \"T0\".\"FCUSTOMERID\" AS \" > T3.ID\", \"T0\".\"FCUSTOMERGROUPFULLNAME\" AS \"CUSTOMERGROUPFULLNAME\" > FROM \"customerGroupDetailCache\".CustomerGroupDetail AS \"T0\" INNER JOIN > \"csspGroupStandardCache\".CsspGroupStandard AS \"T1\" ON > \"T0\".\"FCUSTOMERGROUPSTANDARDID\" = \"T1\".\"FID\" INNER JOIN > \"customerCache\".CustomerIgniteInfo AS \"T3\" ON \"T0\".\"FCUSTOMERID\" = > \"T3\".\"FID\" WHERE (\"T3\".\"FID\" = '3NsAAABI7bq/DAQO' AND > \"T1\".\"FID\" = '00000000-0000-0000-0000-000000000002BC122A7F')"; long t1 > = System.currentTimeMillis(); > Class.forName("org.apache.ignite.IgniteJdbcThinDriver"); Connection conn = > DriverManager.getConnection("jdbc:ignite:thin:// > 192.168.63.36?distributedJoins=true"); long t2 = > System.currentTimeMillis(); logger.error("IgniteJdbcThinDriver getconn time > ="+(t2-t1)+"ms"); PreparedStatement preparedStatement = > conn.prepareStatement(sql); t1 = System.currentTimeMillis(); > logger.error("IgniteJdbcThinDriver preparedStatement time ="+(t1-t2)+"ms"); > ResultSet resultSet = preparedStatement.executeQuery(); while > (resultSet.next()) > System.out.println("resultSet=="+resultSet.getObject(1)); t2 = > System.currentTimeMillis(); > logger.error("IgniteJdbcThinDriver execute sql time ="+(t2-t1)+"ms"); > Class.forName("org.apache.ignite.IgniteJdbcDriver"); > Connection conn2 = > DriverManager.getConnection("jdbc:ignite:cfg://distributedJoins=true:cache=baseUnitCache > @file:D:/ignite/cof/default-config.xml"); t1 = > System.currentTimeMillis(); logger.error("IgniteJdbcDriver getconn2 time > ="+(t1-t2)+"ms"); PreparedStatement preparedStatement2 = > conn2.prepareStatement(sql); t2 = System.currentTimeMillis(); > logger.error("IgniteJdbcDriver preparedStatement2 time ="+(t2-t1)+"ms"); > ResultSet resultSet2 = preparedStatement2.executeQuery(); while > (resultSet2.next()) > System.out.println("resultSet2==="+resultSet2.getObject(1)); t1 = > System.currentTimeMillis(); logger.error("IgniteJdbcDriver execute sql2 > time ="+(t1-t2)+"ms"); } catch (Exception e) { logger.error(e); } } > > the log is here: > [(TestMain.java:417)]IgniteJdbcThinDriver getconn time =245ms > [(TestMain.java:420)]IgniteJdbcThinDriver preparedStatement time =8ms > resultSet==3NsAAABJbRloQTCA [(TestMain.java:425)]IgniteJdbcThinDriver > execute sql time =2275ms [(TestMain.java:430)]IgniteJdbcDriver getconn2 > time =11172ms [(TestMain.java:433)]IgniteJdbcDriver preparedStatement2 time > =2ms resultSet2===3NsAAABJbRloQTCA [(TestMain.java:438)]IgniteJdbcDriver > execute sql2 time =2836ms > > I have tried many times ,it's the same . > This is single node. It's took double time in 3 node. > Thanks. > > At 2017-12-05 15:12:45,"Denis Mekhanikov" <[email protected]> wrote: > > Lucky, > > I looks strange, that client driver works slower than thin. Normally it > should work just like cache.query() + network overhead. > Maybe you included connection time into your evaluation? Or something > else? You should compare query execution time, when connection is already > established and all preparatory work is done. > > Can you share code of your benchmark? I'd like to make sure, that all > measurements are correct. > >
