Sun Java System Application Server Enterprise Edition 8.1 2005Q2 Performance Tuning Guide

Tuning for Solaris

Tuning Parameters

Tuning Solaris TCP/IP settings benefits programs that open and close many sockets. Since the Application Server operates with a small fixed set of connections, the performance gain might not be significant.

The following table shows Solaris tuning parameters that affect performance and scalability benchmarking. These values are examples of how to tune your system for best performance.

Table 5–1 Tuning Parameters for Solaris

Parameter  

Scope  

Default  

Tuned Value  

Comments  

rlim_fd_max

/etc/system 

1024 

8192 

Limit of process open file descriptors. Set to account for expected load (for associated sockets, files, and pipes if any). 

rlim_fd_cur

/etc/system 

1024 

8192 

 

sq_max_size

/etc/system 

Controls streams driver queue size. Setting to 0 makes it infinity so lack of buffer space does not affect performance runs. Set on clients too. 

tcp_close_wait_interval

ndd /dev/tcp 

240000 

60000 

Set on clients too. 

tcp_time_wait_interval

ndd /dev/tcp 

240000 

60000 

 

tcp_conn_req_max_q

ndd /dev/tcp 

128 

1024 

 

tcp_conn_req_max_q0

ndd /dev/tcp 

1024 

4096 

 

tcp_ip_abort_interval

ndd /dev/tcp 

480000 

60000 

 

tcp_keepalive_interval

ndd /dev/tcp 

7200000 

900000 

Decrease for high traffic web sites. 

tcp_rexmit_interval_initial

ndd /dev/tcp 

3000 

3000 

Increase if retransmission is greater than 30-40%. 

tcp_rexmit_interval_max

ndd /dev/tcp 

240000 

10000 

 

tcp_rexmit_interval_min

ndd /dev/tcp 

200 

3000 

 

tcp_smallest_anon_port

ndd /dev/tcp 

32768 

1024 

Set on clients, too. 

tcp_slow_start_initial

ndd /dev/tcp 

Slightly faster transmission of small amounts of data. 

tcp_xmit_hiwat

ndd /dev/tcp 

8129 

32768 

Size of transmit buffer. 

tcp_recv_hiwat

ndd /dev/tcp 

8129 

32768 

Size of transmit buffer. 

tcp_recv_hiwat

ndd /dev/tcp 

8129 

32768 

Size of receive buffer. 

tcp_conn_hash_size

ndd /dev/tcp 

512 

8192 

Size of connection hash table. See Sizing the Connection Hash Table

Sizing the Connection Hash Table

The connection hash table keeps all the information for active TCP connections. Use the following command to get the size of the connection hash table:

ndd -get /dev/tcp tcp_conn_hash

This value does not limit the number of connections, but it can cause connection hashing to take longer. The default size is 512.

To make lookups more efficient, set the value to half of the number of concurrent TCP connections that are expected on the server. You can set this value only in /etc/system, and it becomes effective at boot time.

Use the following command to get the current number of TCP connections.

netstat -nP tcp|wc -l

File Descriptor Setting

On Solaris, setting the maximum number of open files property using ulimit has the biggest impact on efforts to support the maximum number of RMI/IIOP clients.

To increase the hard limit, add the following command to /etc/system and reboot it once:

set rlim_fd_max = 8192

Verify this hard limit by using the following command:

ulimit -a -H

Once the above hard limit is set, increase the value of this property explicitly (up to this limit) using the following command:

ulimit -n 8192

Verify this limit by using the following command:

ulimit -a

For example, with the default ulimit of 64, a simple test driver can support only 25 concurrent clients, but with ulimit set to 8192, the same test driver can support 120 concurrent clients. The test driver spawned multiple threads, each of which performed a JNDI lookup and repeatedly called the same business method with a think (delay) time of 500ms between business method calls, exchanging data of about 100KB.

Using Alternate Threads

The Solaris operating environment by default supports a two-level thread model (up to Solaris 8). Application-level Java threads are mapped to user-level Solaris threads, which are multiplexed on a limited pool of light weight processes (LWPs). To conserve kernel resources and maximize system efficiency, you need only as many LWPs as there are processors on the system. This helps when there are hundreds of user-level threads. You can choose from multiple threading models and different methods of synchronization within the model, depending on the JVM.

Try to load the alternate libthread.so in /usr/lib/lwp/ on Solaris 8 by changing the LD_LIBRARY_PATH to include /usr/lib/lwp before /usr/lib. Both give better throughput and system utilization for certain applications; especially those using fewer threads.

By default, the Application Server uses /usr/lib/lwp. Change the default settings to not use the LWP by removing /usr/lib/lwp from the LD_LIBRARY_PATH in the startserv script, but avoid doing this unless it is absolutely required.

For applications using many threads, /usr/lib/libthread.so is the best library to use. Of course, see using -Xconcurrentio for applications with many threads as this will not only turn on LWP based sync, the default in 1.4, but also turn off TLABS, or thread local allocation buffers, which can chew up the heap and cause premature garbage collection.

Further Information

For more information on Solaris threading issues, see Solaris and Java Threading.

For additional information on tuning the HotSpot JVM, see Further Information .