There's more...

Deciding how many connections your pool will hold, as well as all the other parameters, is an architecture decision made based on a number of factors such as the type of data, database design, application and user behavior, and so on. We could write a whole book about it.

But if you are starting from scratch and/or still don't need much information, consider a number between 10% to 20% of your concurrent users. In other words, if your application has, for instance, 100 concurrent users, you should provide 10 to 20 connections to your pool.

You will know that your connections aren't enough if some methods are taking too much time to get a connection from the pool (it should take no time at all). It means that the server has ...

Get Java EE 8 Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.