Open ghkvud2 opened 1 year ago
I also have same issue. I set maximumPoolSize
to 10 only, so minimumIdle is also 10.
I expected it would be 10 connections after I create datasource, but actually there is only one connection.
I checked my MySQL db server and also confirmed that there is only single additional connection.
Why it doesn't work as manual?
May I miss something? please let me know
I don't know why, but when I set the log level to debug, it worked Give that a try.
Ah, finally I confirmed that it had worked as expected.
It was because of my mistaken debugging timing.
Does it mean that the logging level of HIKARI is changed to debug and it works as expected? It works well if I set the log level to debug...That's a little weird. I don't understand that the number of connections is affected by the log level. Can you explain your situation in more detail? 이상한 상황이네요...
Oh, actually it worked with info level. BTW, you're Korean, too. Nice to meet you ;)
How did you check the open connection count, though?
I checked on DB server side(MySQL) with the command
mysql> show status where `variable_name` = 'Threads_connected';
This command shows opened connections count.
So..
After creating hikariCP datasource with maxPoolSize = 5
, then I Thread.sleep
a few seconds while checking connection count on DB side.
In this way, I confirmed that it opened 5 connections as expected.
Below is code snippet.
@Test
public void test() throws SQLException, InterruptedException {
HikariDataSource ds = getDatasource();
Thread.sleep(5000);
ds.close();
}
private HikariDataSource getDatasource() {
HikariConfig config = new HikariConfig();
config.setJdbcUrl("jdbc:mysql://localhost:3306/exampledb?createDatabaseIfNotExist=true&useUnicode=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Jakarta&useSSL=false");
config.setUsername("root");
config.setMaximumPoolSize(5);
return new HikariDataSource(config);
}
Nice to meet you, too.
In my case, I really can't connect as much as the maximum PoolSize.
I'm using Oracle, and I've made sure that there's only exactly one session right after running the application. So when two connections are required in one service logic cycle (there is a logic running with the requried_new option of Spring @transactional), a connection timeout occurs.
As I wrote in the text...It is ridiculous that if the logging level of the hikari package is set to debug, the connection is as good as maximumPoolSize.
Hello, I am having a hard time using Hikaricp, so I ask for help. In certain situations, there is a problem that the hikari pool is not filled with connections as much as the maximum-pool-size, and only exactly one connection is filled.
[Development environment]
Here's the Hikari setup log.
Strangely, if the setting value is changed as shown below, the connection is normally filled by the maximum-pool-size.
At first, I thought it was a communication problem between the application and the DB, but I don't think it's a network problem when I see one connection connected. And it's really weird that changing the settings above doesn't cause any problems.
And other processes running on the same server are using the connection without any problems. (Of course, the development language and framework are different.)
Can you tell me what else I need to look at?