brettwooldridge / HikariCP

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

HikariCP created too many pools.... #1122

Closed Lumos-Nox closed 6 years ago

Lumos-Nox commented 6 years ago

Environment

HikariCP version: 2.7.8
JDK version     : 1.8.0_161
Database        : MySQL
Driver version  : 5.1.23

Configurations

public SomeClass() {
        this.config = new HikariConfig();
        this.config.setJdbcUrl("jdbc:mysql://localhost:3306/xxx");
        this.config.setUsername("xxx");
        this.config.setPassword("xxx");
        this.config.setConnectionTimeout(10000);
        this.config.setIdleTimeout(30000);
        this.config.setMaxLifetime(90000);
        this.config.setMaximumPoolSize(8);
        this.sql2o = new Sql2o(new HikariDataSource(config));
}

Results

mysql> show full processlist;
...
| 234 | sevaq | localhost:49899 | dbappdev | Sleep   |   13 |          | NULL             |
| 235 | sevaq | localhost:49900 | dbappdev | Sleep   |   12 |          | NULL             |
| 236 | sevaq | localhost:49901 | dbappdev | Sleep   |   12 |          | NULL             |
| 237 | sevaq | localhost:49902 | dbappdev | Sleep   |   11 |          | NULL             |
| 238 | sevaq | localhost:49903 | dbappdev | Sleep   |   11 |          | NULL             |
| 239 | sevaq | localhost:49904 | dbappdev | Sleep   |   11 |          | NULL             |
| 240 | sevaq | localhost:49905 | dbappdev | Sleep   |   10 |          | NULL             |
| 241 | sevaq | localhost:49906 | dbappdev | Sleep   |   10 |          | NULL             |
| 242 | sevaq | localhost:49907 | dbappdev | Sleep   |    8 |          | NULL             |
| 243 | sevaq | localhost:49909 | dbappdev | Sleep   |    3 |          | NULL             |
| 244 | sevaq | localhost:49910 | dbappdev | Sleep   |    3 |          | NULL             |
| 245 | sevaq | localhost:49911 | dbappdev | Sleep   |    3 |          | NULL             |
| 246 | sevaq | localhost:49912 | dbappdev | Sleep   |    3 |          | NULL             |
| 247 | sevaq | localhost:49913 | dbappdev | Sleep   |    3 |          | NULL             |
| 248 | sevaq | localhost:49914 | dbappdev | Sleep   |    3 |          | NULL             |
| 249 | sevaq | localhost:49915 | dbappdev | Sleep   |    3 |          | NULL             |
| 250 | sevaq | localhost:49916 | dbappdev | Sleep   |    3 |          | NULL             |
...

Hi, I'm using Sql2o and HikariCP to develop web application. Unlike other connection pools, I found that this connection pool could not be reused. And it kept creating pool every time I submit the form. I googled the problem but nothing could help. So I'm here to ask you to get it straightened out. Any solutions are welcome. Thanks in advance. 1412

solinad21 commented 4 years ago

i have the same problem as you, how did yo avoid this problem?