brettwooldridge / HikariCP

光 HikariCP・A solid, high-performance, JDBC connection pool at last.
Apache License 2.0
20.01k stars 2.93k forks source link

BeeCP's Persformance score too high #1513

Open Chris2018998 opened 4 years ago

Chris2018998 commented 4 years ago

Dear All,

I am a Java new, I made a simple JDBC Pool(BeeCP:http://www.github.com/Chris2018998/BeeCP),

and tested its performance with HikariCP‘ benchmark,but its score is higher than 'HikariCP'.

please help me to find out the cause. Appreciate for help from anyone.

It is not a AD, thanks!

billoneil commented 4 years ago

Have you read through the various Wiki's especially this one https://github.com/brettwooldridge/HikariCP/wiki/%22My-benchmark-doesn't-show-a-difference.%22?

Chris2018998 commented 4 years ago

Hi Bill,

Thank you very much. I have read it and add some connection reset code to my pool, then retested it, but the performance score still be high(the score has reduced, which is right direction), my test code

 private void setupBeeCPWithCompete(){
    BeeDataSourceConfig config = new BeeDataSourceConfig();
    config.setDriverClassName(jdbcDriver);
    config.setJdbcUrl(jdbcUrl);
    config.setUsername(jdbcUsername);
    config.setPassword(jdbcPassword);
    config.setMaxActive(maxPoolSize);
    config.setInitialSize(MIN_POOL_SIZE);
    config.setMaxWait(8000);
    config.setPreparedStatementCacheSize(10);
    config.setConnectionTestSQL("select 1 from dual");
    config.setClearSQLWarnings(true);
    config.setTestOnBorrow(true);
    config.setDefaultAutoCommit(false); //<----- maybe here(new code added )
    DS = new BeeDataSource(config);
 }

I added a real db table to the benchmark source to test 'roll back on return'

    @Setup(Level.Trial)
    public void setup(BenchmarkParams params)
    {
    //...........
        switch (pool)
        {
        case "hikari":
        stmSQL="INSERT INTO test(ds_name)VALUES ('hikari')";
            setupHikari();
            break;
     case "tomcat":
        stmSQL="INSERT INTO test(ds_name)VALUES ('tomcat')";
            setupTomcat();
            break;
        case "beeCP-compete":
        stmSQL="INSERT INTO test(ds_name)VALUES ('beeCP-compete')";
            setupBeeCPWithCompete();
        break;
        //...........
      }
}

1 retested result with stubDriver( PC: I3-7100, 8G ) SubDriver

2 retested with Mysql5.6.4-64 ( PC: I3-7100, 8G ) Mysql

Mysql_tableQry

I have uploaded the test package to my project, download url is: https://github.com/Chris2018998/BeeCP/blob/master/doc/performance/HikariCP-benchmark_BeeCP.zip