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