Reputation: 24005
I was trying to use the JDBC to connect to my MySQL database in the setup and teardown methods of my Junit tests that are being run through Jmeter. Jmeter will create multiple threads, each of which will run one instance of my test.
The issue that I run into, is if I instantiate my datasource in the setup of my Junit test, then my connection pool runs out of connections. Is there a way to design my test so that this does not happen? I'm trying to avoid increasing my max MySQL connections to solve this issue.
Upvotes: 0
Views: 838
Reputation: 17775
A couple suggestions:
Upvotes: 0
Reputation: 308763
Yes, make sure that each test closes the connection and returns it to the pool when it's done. Sounds like that's not happening, but I can't be sure.
If that's not the case, I'd recommend tuning your connection and thread pool sizes better so you don't run out.
Upvotes: 1