From the article:
-Xms128m -Xmx256m
The Sun JVM will run
significantly faster with the following config instead:
-Xms256m -Xmx256m
That's because the Sun implementation acquires and releases memory from / to the OS way too aggresively if the "ms != mx". Furthermore, either your server has the 256MB available or it doesn't. If you don't have it available, don't set the max that high. If you do have it available, you gain nothing from setting the min lower. This isn't a desktop system, it's a server -- make sure you have the necessary resources and if you do then use them!
Furthermore, unless it causes instability, you should always use:
-server
For code such as JDBC drivers, it can make a big difference by more agressively inlining methods.
Connection Pool Size: 15-20 is more than enough to handle an average application. Never have more connections than threads that can use them. For MySQL, the pool size is resource throttling, not saving connection setup time. Click here for a chart that shows the number of connections used doesn't change between a pool size of 10 and 20.
Connection pooling is one of the least understood "tunables" for appliation servers. It can make a huge difference in performance. I'll be talking about this at a BoF session at TheServerSide Symposium coming up soon. Basically, you need to set the connection pool size to infinite to tune for the optimum number of threads, and having achieved that, then set it to self-growing (but not shrinking) and do another load test to see how large it grows "naturally." That is *probably* (but not always, for a variety of reasons) the "correct" (i.e. optimum) size for the connection pool. Set its min and max to that value for the production deployment.
One of the biggest perf*cks is the connection testing with certain databases. If you can get away with it, don't enable it. Otherwise, make sure that the check only gets done "rarely" (e.g. every 10 seconds instead of every use.) Some connection pool impls are now building this logic in, thankfully. Also, eval how the pool is testing the connections, and make sure that (a) the designated approach will actually test the connection and (b) that the approach (e.g. a specific query) it is the most optimal approach that the database can support.
Peace,
Cameron Purdy
Tangosol, Inc.Coherence: Clustered JCache for Grid Computing!