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