Jack Russel
Jack Russel

Reputation: 33

Connection pool vs separate connections

In my program I am accessing a wep api. There can be up to 7 different threads accessing different servers of the web api. Each thread is responsible for one server - and each server rate limits each thread. Each thread updates the same mysql database. The number of threads remains constant.

In my example situation, is there any need for a connection pool? Shouldn't I just open 7 different connections that will be open for the life of the program?

Upvotes: 0

Views: 404

Answers (1)

brettw
brettw

Reputation: 11114

Use a pool. Network disruptions occur. Databases kill connections after max. lifetime settings. Firewalls and load balancers terminate connections.

As the author I am naturally biased, but I recommend HikariCP.

Upvotes: -1

Related Questions