brettwooldridge / HikariCP-benchmark

JHM benchmarks for JDBC Connection Pools
180 stars 69 forks source link

Could you add BeeCP into the benchmark project ? Thanks. #19

Closed Chris2018998 closed 4 years ago

Chris2018998 commented 4 years ago

pom.xml

<dependency>
    <groupId>com.github.chris2018998</groupId>
    <artifactId>BeeCP</artifactId>
    <version>1.5.0</version>
</dependency>

'BenchBase.java'

BenchBase.txt

1: import block

.....
import cn.beecp.BeeDataSource;
import cn.beecp.BeeDataSourceConfig;

2: pool list Param

@Param({ "hikari", "dbcp2", "tomcat", "c3p0", "vibur", "druid", "druid-stat", "druid-stat-merge" ,"beeCP-compete","beeCP-fair"})

3: pool setup block

        case "beeCP-compete":
             setupBeeCPWithCompete();
         break;
    case "beeCP-fair":
             setupBeeCPWithFair();
             break;

4: pool close block

        case "beeCP-compete":
            ((BeeDataSource) DS).close();
            break;   
    case "beeCP-fair":
            ((BeeDataSource) DS).close();
            break; 

5: pool block

    private void setupBeeCPWithCompete(){
        BeeDataSourceConfig config = new BeeDataSourceConfig(
            "com.zaxxer.hikari.benchmark.stubs.StubDriver", 
            jdbcUrl,
            "brettw", 
            "");    
        config.setMaxActive(maxPoolSize);
        config.setInitialSize(MIN_POOL_SIZE);
        config.setMaxWait(8000);
        config.setPreparedStatementCacheSize(10);
        config.setConnectionTestSQL("select 1 from dual");
        config.setTestOnBorrow(true);
        DS = new BeeDataSource(config);
    }

    private void setupBeeCPWithFair(){
        BeeDataSourceConfig config = new BeeDataSourceConfig(
            "com.zaxxer.hikari.benchmark.stubs.StubDriver", 
            jdbcUrl,
            "brettw", 
            "");    
        config.setMaxActive(maxPoolSize);
        config.setInitialSize(MIN_POOL_SIZE);
        config.setMaxWait(8000);
        config.setPreparedStatementCacheSize(10);
        config.setConnectionTestSQL("select 1 from dual");
        config.setTestOnBorrow(true);
        config.setFairMode(true);
        DS = new BeeDataSource(config);
    }
brettwooldridge commented 4 years ago

Hi Chris,

I am reluctant to do that, because there is no way to configure BeeCP in a way that provides equivalent "safe" operation. BeeCP does not track and reset various important JDBC state. As a result, it always reports unrealistically high results, which is misleading to users.

All other pools are also lacking in safe operation, but at least support the ability to configure "more safe" behavior (at the cost of performance).

See this as an example of what is lacking.

Chris2018998 commented 4 years ago

Thanks for your reply. I have add some connection reset code , and retested it, the score has reduced, but still be high. I have open a new Issue at 'HikariCP' project, so close it.