原帖由 lilyerFeng 于 2009-6-4 16:22 发表 有一篇文章很古老,但是很好:http://www.ibm.com/developerworks/websphere/library/techarticles/0602_lurie/0602_lurie.html
总体的思想如下:Ø无论如何,应该先保证做到应用程序调优,这是提高性能最显著的方法。比如:如果应用程序...
显示全部
总体的思想如下:
Ø无论如何,应该先保证做到应用程序调优,这是提高性能最显著的方法。比如:如果应用程序设计有问题,比如:数据库查询没有where语句,导致返回的结果集过大,容易引起OutOfMemory;比如wait()过长的时间;比如应用程序设计会导致死锁;比如巨大的HTTPSession;比如cache过多的数据等等,都是导致性能下降的最直接原因。
然后再考虑WAS调优。调优时,有几点要考虑:
1) Getting a baseline performance number and then
set the tuning objective (吞吐量, 平均响应时间等)
2) Write down your tuning log - A log of what you changed and why you changed it.
3) Monitoring your environment CPU utilization (Top command , vertical and horizontal scale-up of CPUs)
Memory utilization (top/vmstat commands)
- The "swap" field should be zero -- if it is not, then the operating system is simulating the presence of more RAM by using disk space, which is of course a slow process.
4) Turn on Verbose GC, Based on Verbose GC log. Ideally, the GC cycle:
GC occurs at intervals longer than 10 seconds or so
GC takes 1 to 2 seconds or so to complete
5) JVM settings – change heap size
Goal: make the heap large enough to make the GC interval longer than 10 seconds, but small enough so the duration is only 1 to 2 seconds.
Notes: With each new JVM version, GC algorithms improve, so this tuning should become easier over time.
6) Connection pool settings
Usually,
The "sweet spot" for a small (4 CPU) database server is servicing 100-200 connections.
WebSphere acts as a connection concentrator in front of the database server. The connection pool size restricts how many database connections are held open to service incoming page requests.
Actions:
If your application uses all available connections, there may be an unmet demand for more connections.
Detect unmet demand by reading the
javacore or by
increasing the number of connections and seeing when the application server stops asking for more.
If the number of connections is the same or greater than the number of WebSphere client users, it is time to search the application for some
sloppy code –
connection leak? 7) Turning on servlet caching
For WebSphere Application Server, The Performance Adviser was kind enough to suggest turning on servlet caching, and performance improved. TPV shows graphical output of PMI.
8) Thread pool count
Sometimes, We need to increase the thread pool in order to keep the CPU entertained.
But remember, a CPU can only drive 50 to 75 Java threads.
收起