Beruflich Dokumente
Kultur Dokumente
08_J2EE_Perf_BestPractices.ppt Page 1 of 58
WebSphere Application Server
Key Tuning Areas
• Threading Issues
• EJBs
• JVM
• HttpSessions
• Connection pools
• Dynacache
08_J2EE_Perf_BestPractices.ppt Page 2 of 58
Web Site Application
Apps and Performance
• Thread dumps
• HttpSession sizing
08_J2EE_Perf_BestPractices.ppt Page 3 of 58
Web Site Application
Common Pitfalls
• Synchronization
• Indefinite delay
• Multi-threading problems
• JSP Issues
08_J2EE_Perf_BestPractices.ppt Page 4 of 58
Web Site Application
Synchronization
08_J2EE_Perf_BestPractices.ppt Page 5 of 58
Web Site Application
Thread Pools
08_J2EE_Perf_BestPractices.ppt Page 6 of 58
Web Site Application
Proper Thread Pool Management
08_J2EE_Perf_BestPractices.ppt Page 7 of 58
Web Site Application
Pooled Object Etiquette
08_J2EE_Perf_BestPractices.ppt Page 8 of 58
Web Site Application
Indefinite Delay
• True for
• Database requests
• Launched threads
• Remote requests of any kind (HTTP sockets, etc.)
08_J2EE_Perf_BestPractices.ppt Page 9 of 58
Web Site Application
Indefinite Delay Exceptions
08_J2EE_Perf_BestPractices.ppt Page 10 of 58
Web Site Application
Other Notable Performance Issues
• Avoid bean.instantiate()
• Initiates disk I/O to check for bean contents
• new the bean instead
08_J2EE_Perf_BestPractices.ppt Page 11 of 58
Web Site Application
Other notable performance issues
08_J2EE_Perf_BestPractices.ppt Page 12 of 58
Web Site Application
JSP Issues
• Also:
• Consider changing JSP reload intervals
08_J2EE_Perf_BestPractices.ppt Page 13 of 58
Web Site Application
Canonical Servlet
• Also avoid
• Fine-grained servlet modeling (opposite problem)
• JSP-only solution
• Difficult to maintain dispersed logic
08_J2EE_Perf_BestPractices.ppt Page 14 of 58
Web Site Application
Flow Examples
SymbolResult.jsp
NotFound.jsp
UnKnownError.jsp MyStatement.jsp
StockQuote.jsp
TradeHistory.jsp
08_J2EE_Perf_BestPractices.ppt Page 15 of 58
WebSphere Application Server
Key Tuning Areas
• Threading Issues
• EJBs
• JVM
• HTTPSessions
• Connection pools
• Dynacache
08_J2EE_Perf_BestPractices.ppt Page 16 of 58
Threads
How Many?
08_J2EE_Perf_BestPractices.ppt Page 17 of 58
Threads
Funnel Queue
150 20 10
Listeners Q Threads Q Connections
u u
e e
u u
e e
HTTP Server Application Server Datasource
08_J2EE_Perf_BestPractices.ppt Page 18 of 58
Threads
Funnel Queue (cont’d)
150 20 10
Listeners Q Threads Q Connections
u u
e e
u u
e e
HTTP Server Application Server Datasource
08_J2EE_Perf_BestPractices.ppt Page 19 of 58
Threads
Frozen Web site
150 20 10
Listeners Q Threads Q Connections
u u
e e
u u
e e
HTTP Server Application Server Datasource
08_J2EE_Perf_BestPractices.ppt Page 20 of 58
WebSphere Application Server
Key Tuning Areas
• Threading Issues
• EJBs
• JVM
• HttpSessions
• Connection pools
• Dynacache
08_J2EE_Perf_BestPractices.ppt Page 21 of 58
EJB 2.0 Performance
700 668
625
600 536
500
Throughput-Request/sec
500
0
EJB Caching Options
08_J2EE_Perf_BestPractices.ppt Page 22 of 58
EJBs
Use a Façade Bean
08_J2EE_Perf_BestPractices.ppt Page 23 of 58
EJBs
Granularity
08_J2EE_Perf_BestPractices.ppt Page 24 of 58
EJBs
Cache Sizing
08_J2EE_Perf_BestPractices.ppt Page 25 of 58
EJBs
Passivation
08_J2EE_Perf_BestPractices.ppt Page 26 of 58
WebSphere Application Server
Key Tuning Areas
• Threading Issues
• EJBs
• JVM
• HttpSessions
• Connection pools
• Dynacache
08_J2EE_Perf_BestPractices.ppt Page 27 of 58
JVM
JVMs and Performance
08_J2EE_Perf_BestPractices.ppt Page 28 of 58
JVM
Heap Size
• Moderate heap sizes work best
• -Xmx=512M for WAS
• -Xmx=768M for WP
• 1 GB heaps supportable on most multiprocessor boxes
• Minimum heapsize
• Production systems set –Xms lower than –Xmx
• Gives headroom for emergencies
• In theory, results in more efficient object table
• “Burst” testing requires –Xms=-Xmx
08_J2EE_Perf_BestPractices.ppt Page 29 of 58
JVM
Garbage Collection
• JDK 1.3.1 GC
• Interim gc’s free memory (multi-threaded)
• Compaction cycle for defragmentation
• Single-thread; stops application work
08_J2EE_Perf_BestPractices.ppt Page 30 of 58
JVM
Memory Leaks
08_J2EE_Perf_BestPractices.ppt Page 31 of 58
JVM
Memory Leak Pattern
08_J2EE_Perf_BestPractices.ppt Page 32 of 58
WebSphere Application Server
Key Tuning Areas
• Threading Issues
• EJBs
• JVM
• HttpSession
• Connection pools
• Dynacache
08_J2EE_Perf_BestPractices.ppt Page 33 of 58
HttpSession
Common Performance Pitfalls
08_J2EE_Perf_BestPractices.ppt Page 34 of 58
HttpSession
Large HttpSession Objects
• Memory overhead
08_J2EE_Perf_BestPractices.ppt Page 35 of 58
HttpSession
Poor Timeout Strategies
08_J2EE_Perf_BestPractices.ppt Page 36 of 58
HttpSession
Poor Persistence Preparation
08_J2EE_Perf_BestPractices.ppt Page 37 of 58
HttpSession
Persistence (cont’d)
08_J2EE_Perf_BestPractices.ppt Page 38 of 58
WebSphere Application Server
Key Tuning Areas
• Threading Issues
• EJBs
• JVM
• HttpSessions
• Connection pools
• Dynacache
08_J2EE_Perf_BestPractices.ppt Page 39 of 58
Datasource
Connection Pool
08_J2EE_Perf_BestPractices.ppt Page 40 of 58
Datasource
Excessive Pool Utilization
08_J2EE_Perf_BestPractices.ppt Page 41 of 58
WebSphere Application Server
Key Tuning Areas
• Threading Issues
• EJBs
• JVM
• HTTPSessions
• Connection pools
• Dynacache
08_J2EE_Perf_BestPractices.ppt Page 42 of 58
External Performance Issues
• Infrastructure
• Server OS
• Network
08_J2EE_Perf_BestPractices.ppt Page 43 of 58
Http Server
• Http Server needs listeners to serve
• Static HTML, gif, jpegs, etc.
• Dynamic page requests
• Site requires sufficient listeners for these requests
08_J2EE_Perf_BestPractices.ppt Page 44 of 58
Http Server
IHS Key Parms for Unix Systems
• MaxClients
• Maximum number of listeners Http Server will start
• 150 – 250 works well for most sites
• StartServers
• Listeners started at Http Server startup
• MaxSpareServers
• Maximum unused listeners Http Server will allow to live
• Set to MaxClients when in doubt
• MinSpareServers
• Http Server tries to keep this many unused listeners alive
• Set to StartServers when in doubt (will not exceed MaxClients)
08_J2EE_Perf_BestPractices.ppt Page 45 of 58
Http Server
Other IHS Unix Parms
• HostnameLookups
• Http Server can do a DNS lookup on incoming address
• Extremely time intensive – do not use!
• Recommend: HostnameLookups off
• LogLevel
• Keep logging at a minimum to reduce overhead
• Do not insert tags or processing during runtime
• Use post-processing tool
• Recommend: LogLevel error (or lower)
• KeepAlive
• Useful for sites with lots of static content
• Maintains connection for extended time to reduce setup overhead
• KeepAliveTimeout should be set reasonably low
08_J2EE_Perf_BestPractices.ppt Page 46 of 58
Http Server
Windows
08_J2EE_Perf_BestPractices.ppt Page 47 of 58
Http Server
Linux Considerations
• IHS Listeners
08_J2EE_Perf_BestPractices.ppt Page 48 of 58
Databases
• Memory buffers
• Maximum connections
08_J2EE_Perf_BestPractices.ppt Page 49 of 58
Databases
Hardware
• Databases
• Tend to be I/O rather than CPU bound
• CPU I/O Wait time higher than WAS systems
• Will existing platform support increased traffic?
08_J2EE_Perf_BestPractices.ppt Page 50 of 58
Databases
Prepared Statement Cache
08_J2EE_Perf_BestPractices.ppt Page 51 of 58
Server
OS Settings
08_J2EE_Perf_BestPractices.ppt Page 52 of 58
Server
When to Clone?
08_J2EE_Perf_BestPractices.ppt Page 53 of 58
Network
08_J2EE_Perf_BestPractices.ppt Page 54 of 58
WebSphere Application Server
Key Tuning Areas
• Threading Issues
• EJBs
• JVM
• HttpSessions
• Connection pools
• Dynacache
08_J2EE_Perf_BestPractices.ppt Page 55 of 58
Dynacache
• WAS 4.x/5.x feature
08_J2EE_Perf_BestPractices.ppt Page 56 of 58
Summary
08_J2EE_Perf_BestPractices.ppt Page 57 of 58
Shameless Plug
ISBN: 0201844540
Available at fine eTailers,
Brick and Mortar stores,
and PubOrder (IBM)!
08_J2EE_Perf_BestPractices.ppt Page 58 of 58