星期三, 四月 28, 2004

TheServerSide.com - TSS Featured Entry

TheServerSide.com - TSS Featured Entry

这里有些经验非常好.paste过来.留着
To get JVM Metrics, i.e. Heap/Garbage Collection stats, add the following to your java command:
-verbose:gc -XX:+PrintGCTimeStamps
The default JVM heap size is 64MB, which is likely too small for most webapps. You can change the default min/max by adding the following to your JAVA_OPTS (or CATALINA_OPTS) environment variable:
-Xms128m -Xmx256m
Young generation sizing - let the JVM do it by specifying:
-XX:+AggressiveHeap
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/J 3.0 is 40-400% faster than 2.0.14 depending on the situation - use the latest driver!
Finally, here is the really good stuff. Below are a number of parameters you can add to your JDBC URL (like autoReconnect=true) to get information from MySQL's JDBC Driver:

Logging Slow Queries: logSlowQueries=true and slowQueryThresholdMillis=n (2000 default)
Reporting Performance Metrics: gatherPerfMetrics=true and reportMetricsIntervalMillis=n (30s default)
Usage Advisor (abandoned objects, un-used columns in selects, incomplete ResultSet traversal): useUsageAdvisor=true