How should I set the connection pool initial size?
In a production system, set the initial size equal to the maximum size. This will create all necessary JDBC connections at server start-up.
The reason is that if initial number of connections is less than the maximum number of connections, the server has to create additional connections when it becomes loaded. When a server is under heavy load, the goal is to only do useful work with minimal overhead. That is exactly the time that you do not want to burden the server with creating additional database connections. For both performance and stability reasons, it is best to have the connection pool make all its connections at startup.