quarkusio/quarkus-quickstarts

Use JMH test Hikari and agroal

zhouzhou19950825 opened this issue · 2 comments

I tested the performance of the data pool through JMH, and compared agroal and hikari. I found that the statement cycle ops/ms index of agroal is half of that of Hikari. Is there a problem with my initial configuration or the parameters are not configured properly?

AgroalDataSourceConfigurationSupplier dataSourceConfiguration = new AgroalDataSourceConfigurationSupplier();
        AgroalConnectionPoolConfigurationSupplier poolConfiguration = dataSourceConfiguration.connectionPoolConfiguration();
        AgroalConnectionFactoryConfigurationSupplier connectionFactoryConfiguration = poolConfiguration
                .connectionFactoryConfiguration();
 connectionFactoryConfiguration.jdbcUrl(jdbcUrl);
        NamePrincipal username = new NamePrincipal("brettw");
        connectionFactoryConfiguration
                .principal(username).recoveryPrincipal(username);
        SimplePassword password = new SimplePassword("");
        connectionFactoryConfiguration
                .credential(password).recoveryCredential(password);
        Class<?> aClass = null;
        try {
            aClass = Class.forName("com.zaxxer.hikari.benchmark.stubs.StubDriver");
        } catch (ClassNotFoundException e) {
            throw new RuntimeException(e);
        }
        connectionFactoryConfiguration.connectionProviderClass(aClass);
        poolConfiguration.maxSize(maxPoolSize);
 poolConfiguration.initialSize(MIN_POOL_SIZE);
AgroalDataSourceConfiguration agroalConfiguration = dataSourceConfiguration.get();
 AgroalDataSource dataSource = new io.agroal.pool.DataSource(agroalConfiguration,
                new AgroalEventLoggingListener("<default>",
                        agroalConfiguration.connectionPoolConfiguration()
                                .transactionRequirement() == AgroalConnectionPoolConfiguration.TransactionRequirement.WARN));

Sanne commented

hi @zhouzhou19950825 - this is interesting but I'm not sure why you're reporting it on our quickstarts and examples project.

May I suggest to open such a request on https://github.com/agroal/agroal ? cc/ @barreiro

Also consider that Agroal and Hikari are not functionally equivalent; Agroal has a better integration with transaction managers. That said, it shouldn't matter so I assume the Agroal team might be interested.

hi @zhouzhou19950825 you can play with https://github.com/agroal/agroal.benchmark (or even expand it) to compare Agroal and Hikari.