Sun Microsystems, Inc Network Circle Santa Clara, CA
Sun GlassFish Enterprise Server 2.1 Performance Tuning Guide
090304@21990
Contents
Tuning the Enterprise Server
100
Tuning for High-Availability
Figures
Page
Tables
Page
Examples
Page
Table P-1Books in the Enterprise Server Documentation Set
Sun GlassFish Enterprise Server Documentation Set
Table P-2Default Paths and File Names
Default Paths and File Names
Table P-3Typographic Conventions
Symbol Conventions
Symbol Conventions
Typographic Conventions
Documentation, Support, and Training
Third-Party Web Site References
Sun Welcomes Your Comments
Process Overview
1Performance Tuning Roadmap
Performance Tuning Roadmap
Performance Tuning Sequence
Application Architecture
Understanding Operational Requirements
Client-Side Presentation
User Authentication and Authorization
Security Requirements
Encryption
Hardware Resources
Administration
General Tuning Concepts
2Factors That Affect Performance
Capacity Planning
To Determine Capacity
User Expectations
Further Information
Java Programming Guidelines
Avoid Serialization and Deserialization
Use StringBuffer to Concatenate Strings
Declare Constants as static final
String str = testing str = str + abc
Assign null to Variables That Are No Longer Needed
Declare Methods as final Only If Necessary
Use DataHandlers for Soap Attachments
Java Server Page and Servlet Tuning
Synchronize Only When Necessary
Declare Method Arguments final
Http Session Handling
Suggested Coding Practices
General Guidelines
Avoid Shared Modified Class Variables
Configuration and Deployment Tips
Disable Security Manager
Optimize SSL
EJB Performance Tuning
Goals
Monitoring EJB Components
Following is a sample of the monitoring output
Monitoring Individual EJB Components
Asadmin get -m monitorableObject
General Guidelines
Use High Performance Beans
Use Caching
Remove Unneeded Stateful Session Beans
Using Local and Remote Interfaces
Cache and Pool Tuning Tips
Use the Appropriate Stubs
Prefer Local Interfaces
Using Pass-By-Reference Semantics
Improving Performance of EJB Transactions
Version Consistency
Using Special Techniques
Configure Jdbc Resources as One-Phase Commit Resources
Use the Least Expensive Transaction Attribute
Entity-mapping cmp-field-mapping
Cmp-field-mapping consistency
To enable request partitioning
When new.VCVERSIONNUMBER = old.VCVERSIONNUMBER Declare
Request Partitioning
Tuning Tips for Specific Types of EJB Components
Entity Beans
Stateful Session Beans
Checkpoint only when needed
Stateless Session Beans
Read-Only Entity Beans
Refresh period
Pre-fetching Container Managed Relationship CMR Beans
OrderTable.OrderID = OrderLineTable.OrderLineOrderID
Close Connections
Jdbc and Database Access
Use Jdbc Directly
Encapsulate Business Logic in Entity EJB Components
Tune the Message-Driven Bean’s Pool Size
Tuning Message-Driven Beans
Asadmin set server.mdb-container.max-pool-size = value
Use getConnection
Limit Use of JMS Connections
Cache Bean-Specific Resources
Deployment Settings
Tuning the Enterprise Server
Use Pre-compiled JavaServer Pages
Logger Settings
Disable Auto-deployment
Disable Dynamic Application Reloading
Log Levels
Web Container Settings
General Settings
Session Properties Session Timeout
Manager Properties Reap Interval
Disable Dynamic JSP Reloading
Overview of EJB Pooling and Caching
EJB Container Settings
Tuning the EJB Container
Monitoring the EJB Container
EJB Pool Settings
Tuning the EJB Pool
EJB Cache Settings
Tuning the EJB Cache
Pool and Cache Settings for Individual EJB Components
Determining the best commit option
Commit Option
Viewing Monitoring Information
Java Message Service Settings
Transaction Service Settings
Monitoring the Transaction Service
Tuning the Transaction Service
Disable Distributed Transaction Logging
Asadmin get -m serverInstance.transaction-service
Keypoint Interval
Http Service Settings
Monitoring the Http Service
Recover On Restart Automatic Recovery
DNS Cache Information dns
Enabled
List --user admin --port
Property name=statsProfilingEnabled value=false
NameLookups
HitRatio
Caching DNS Entries
Limit DNS Lookups to Asynchronous
Keep Alive keep-alive
File Cache Information file-cache
Request Processing
Tuning the Http Service
Access Log
Connection Queue
Request Timeout
Thread Count
Initial Thread Count
Keep Alive
Buffer Length
Max Connections
Time Out
DNS Lookup Enabled
Http Protocol
Http File Cache
Small/Medium File Size and File Size Limit
Max Files Count
Hash Init Size
Max Age
Tuning Http Listener Settings
Network Address
Acceptor Threads
Monitoring the ORB
ORB Settings
Overview
How a Client Connects to the ORB
Thread Pools
Tuning the ORB
3Tunable ORB Settings
Connection Statistics
ORB Thread Pool Parameters
Tunable ORB Parameters
Using multiple connections
Client ORB Properties
Controlling connections between client and server ORB
Thread Pool Sizing
Examining Iiop Messages
Load Balancing
Improving ORB Performance with Java Serialization
Using JSG for Application Clients
Thread Pool Settings
Tuning Thread Pools Unix /Linux only
To Enable Java Serialization
Monitoring Jdbc Connection Pools
Jdbc Connection Pool Settings
Tuning Jdbc Connection Pools
Resources
Pool Size Settings
Timeout Settings
4Connection Pool Sizing
Connection Validation Settings
Isolation Level Settings
Transaction Support
Connector Connection Pool Settings
Testpool
Page
Java Virtual Machine Settings
Tuning the Java Runtime System
Managing Memory and Garbage Collection
Tuning the Garbage Collector
Choosing the Garbage Collection Algorithm
To use the CMS collector
Additional Information
Tracing Garbage Collection
Other Garbage Collector Settings
Tuning the Java Heap
Guidelines for Java Heap Sizing
1Maximum Address Space Per Process
Xmsvalue Xmxvalue
Heap Tuning Parameters
Example 4-1Heap Configuration on Solaris
Rebasing DLLs on Windows
Survivor Ratio Sizing
To rebase the Application Server’s DLLs
Enter this command rebase -b 0x6000000 *.dll
For more information on tuning the JVM, see
Page
Processors
Server Scaling
Memory
Disk Space
Networking
Tuning Parameters
Sizing the Connection Hash Table
Ndd -get /dev/tcp tcpconnhash
Netstat -nP tcpwc -l
File Descriptor Setting
Linux Configuration
File Descriptors on IP Stack Settings on
Tuning for Solaris on
File Descriptors
IP Stack Settings
Tuning for Linux platforms
Virtual Memory
Soft Nofile 65535 Hard
Session required /lib/security/pamlimits.so
Network Interface
Disk I/O Settings
TCP/IP Settings
To tune the TCP/IP settings
Tuning Operating System and TCP Settings
Tuning UltraSPARC T1-Based Systems
2Tuning 64-bit Systems for Performance Benchmarking
Disk Configuration
Network Configuration
Start Options
106
Tuning Hadb
Disk Use
Calculating Hadb Data Device Size
Hadbm set TotalDatadeviceSizePerNode
Tuning Data Device Size
Vmstat -S
Memory Allocation
Placing Hadb files on Physical Disks
Beware last flush/fputs took too long
Performance
DataBufferPoolSize
NodeNo TotalSize FreeSize Usage 512 504
Tuning DataBufferPoolSize
LogBufferSize
Hadbm set DataBufferPoolSize
Node No Avail Free Size
Tuning LogBufferSize
InternalLogbufferSize
Hadbm resourceinfo --logbuf
Hadbm set InternalLogbufferSize
Tuning InternalLogbufferSize
NumberOfLocks
Hadbm resourceinfo --nilogbuf
Tuning NumberOfLocks
Calculating the number of locks
Summary
Node No Avail Free Waits 50000
Timeouts
Jdbc connection pool timeouts
Load Balancer timeouts
No space left on device
Tuning the Enterprise Server for High-Availability
Operating System Configuration
Hadb timeouts
Tuning Session Persistence Frequency
Web-method
Time-based
Modified-session
Session Persistence Scope
Session Size
Session
Checkpointing Stateful Session Beans
Configuring the Jdbc Connection Pool
Enabling the Health Checker
Configuring the Load Balancer
Tuning for High-Availability 121
122
Index
Index
125
Monitoring transaction service
Session timeout
128