包含在尋找其他文件熱門支援資源 | 以 PDF 格式下載這本書 (1343 KB)
Chapter 4 Platform-Specific Issues and TipsThis chapter provides platform-specific tuning tips, and includes the following topics: Solaris Platform-Specific IssuesThis section discusses miscellaneous Solaris-specific issues and tuning tips, and includes the following topics: Files Open in a Single Process (File Descriptor Limits)Different platforms each have limits on the number of files that can be open in a single process at one time. For busy sites, you might need to increase that number. On Solaris systems, control this limit by setting rlim_fd_max in the /etc/system file. For Solaris 8, the default is 1024, which you can increase to 65536. For Solaris 9 and 10, the default is 65536, which doesn't need to be increased. After making this or any change in the /etc/system file, reboot Solaris to put the new settings into effect. In addition, if you upgrade to a new version of Solaris, any line added to /etc/system should be removed and added again only after verifying that it is still valid. An alternative way to make this change is using the ulimit –n "value" command. Using this command does not require a system restart. However, this command only changes the login shell, while editing the etc/system file affects all shells. Failure to Connect to HTTP ServerIf users are experiencing connection timeouts from a browser to Web Server when the server is heavily loaded, you can increase the size of the HTTP listener backlog queue. To increase this setting, edit the HTTP listener's listen queue value. In addition to this setting, you must also increase the limits within the Solaris TCP/IP networking code. There are two parameters that are changed by executing the following commands: /usr/sbin/ndd -set /dev/tcp tcp_conn_req_max_q 8192 /usr/sbin/ndd -set /dev/tcp tcp_conn_req_max_q0 8192 These two settings increase the maximum number of two Solaris listen queues that can fill up with waiting connections. tcp_conn_req_max_q increases the number of completed connections waiting to return from an accept() call. tcp_conn_req_max_q0 increases the maximum number of connections with the handshake incomplete. The default values are 128 and 1024 respectively. To automatically have these ndd commands executed after each system reboot, place them in a file called /etc/init.d/network-tuning and create a link to that file named /etc/rc2.d/S99network-tuning. You can monitor the effect of these changes by using the netstat -s command and looking at the tcpListenDrop, tcpListenDropQ0, and tcpHalfOpenDrop values. Review them before adjusting these values. If they are not zero, adjust the value to 2048 initially, and continue to monitor the netstat output. The Web Server HTTP listener's listen queue setting and the related Solaris tcp_conn_req_max_q and tcp_conn_req_max_q0 settings should match the throughput of the Web Server. These queues act as a "buffer" to manage the irregular rate of connections coming from web users. These queues allow Solaris to accept the connections and hold them until they are processed by the Web Server. You don't want to accept more connections than the Web Server is able to process. It is better to limit the size of these queues and reject further connections than to accept excess connections and fail to service them. The value of 2048 for these three parameters typically reduces connection request failures, and improvement has been seen with values as high as 4096. This adjustment is not expected to have any adverse impact in any web hosting environment, so you can consider this suggestion even if your system is not showing the symptoms mentioned. Connection Refused ErrorsIf users are experiencing connection refused errors on a heavily loaded server, you can tune the use of network resources on the server. When a TCP/IP connection is closed, the port is not reused for the duration of tcp_time_wait_interval (default value of 240000 milliseconds). This is to ensure that there are no leftover segments. The shorter the tcp_time_wait_interval, the faster precious network resources are again available. This parameter is changed by executing the following command (do not reduce it below 60000): usr/sbin/ndd -set /dev/tcp tcp_time_wait_interval 60000 To automatically have this ndd command executed after each system reboot, place it in a file called /etc/init.d/network-tuning and create a link to that file named /etc/rc2.d/S99network-tuning. If your system is not exhibiting the symptoms mentioned, and if you are not well-versed in tuning the TCP protocol, it is suggested that you do not change the above parameter. Tuning TCP BufferingIf you are seeing unpredictable intermittent slowdowns in network response from a consistently loaded server, you might investigate setting the sq_max_size parameter by adding the following line to the /etc/system file: set sq_max_size=512 This setting adjusts the size of the sync queue, which transfers packets from the hardware driver to the TCP/IP protocol driver. Using the value of 512 allows the queue to accommodate high volumes of network traffic without overflowing. Using the Solaris Network Cache and Accelerator (SNCA)The Solaris Network Cache and Accelerator (SNCA) is a caching server that provides improved web performance to the Solaris operating system. It is assumed that SNCA has been configured for the system on which the Web Server is running. For more information about SNCA and its configuration and tuning, refer to the following man pages on your system:
|
|
Parameter |
Scope |
Default Value |
Tuned Value |
Comments |
|---|---|---|---|---|
|
/etc/system |
65536 |
65536 |
Process open file descriptors limit; should account for the expected load (for the associated sockets, files, and pipes if any). |
|
|
/etc/system |
2 |
0 |
Controls streams driver queue size; setting to 0 makes it infinite so the performance runs won’t be hit by lack of buffer space. Set on clients too. Note that setting sq_max_size to 0 might not be optimal for production systems with high network traffic. |
|
|
ndd /dev/tcp |
240000 |
60000 |
Set on clients too. |
|
|
ndd /dev/tcp |
128 |
1024 | ||
|
ndd /dev/tcp |
1024 |
4096 | ||
|
ndd /dev/tcp |
480000 |
60000 | ||
|
ndd /dev/tcp |
7200000 |
900000 |
For high traffic web sites, lower this value. |
|
|
ndd /dev/tcp |
3000 |
3000 |
If retransmission is greater than 30-40%, you should increase this value. |
|
|
ndd /dev/tcp |
240000 |
10000 | ||
|
ndd /dev/tcp |
200 |
3000 | ||
|
ndd /dev/tcp |
32768 |
1024 |
Set on clients too. |
|
|
ndd /dev/tcp |
1 |
2 |
Slightly faster transmission of small amounts of data. |
|
|
ndd /dev/tcp |
8129 |
32768 |
To increase the transmit buffer. |
|
|
ndd /dev/tcp |
8129 |
32768 |
To increase the receive buffer. |
Use a combination of tunable parameters and other parameters to tune your system for performance benchmarking. These values are an example of how you might tune your system to achieve the desired result.
The following table shows the operating system tuning for Solaris 10 used when benchmarking for performance and scalability on UtraSPARC T1–based systems (64 bit systems).
Table 4–2 Tuning 64–bit Systems for Performance Benchmarking|
Parameter |
Scope |
Default Value |
Tuned Value |
Comments |
|---|---|---|---|---|
|
/etc/system |
65536 |
260000 |
Process open file descriptors limit; should account for the expected load (for the associated sockets, files, pipes if any). |
|
|
/etc/system |
1 | |||
|
/etc/system |
2 |
0 |
Controls streams driver queue size; setting to 0 makes it infinite so the performance runs won’t be hit by lack of buffer space. Set on clients too. Note that setting sq_max_size to 0 might not be optimal for production systems with high network traffic. |
|
|
0 | ||||
|
1 | ||||
|
/etc/system |
0 | |||
|
/etc/system |
2048 | |||
|
/etc/system |
2048 | |||
|
/etc/system |
384 | |||
|
ipge:ipge_dvma_thresh |
/etc/system |
384 | ||
|
/etc/system |
1 | |||
|
ndd /dev/tcp |
128 |
3000 | ||
|
ndd /dev/tcp |
1024 |
3000 | ||
|
ndd /dev/tcp |
4194304 | |||
|
ndd/dev/tcp |
2097152 | |||
|
ndd /dev/tcp |
8129 |
400000 |
To increase the transmit buffer. |
|
|
ndd /dev/tcp |
8129 |
400000 |
To increase the receive buffer. |
Note that the IPGE driver version is 1.25.25.
If HTTP access is logged, follow these guidelines for the disk:
Write access logs on faster disks or attached storage.
If running multiple instances, move the logs for each instance onto separate disks as much as possible.
Enable the disk read/write cache. Note that if you enable write cache on the disk, some writes might be lost if the disk fails.
Consider mounting the disks with the following options, which might yield better disk performance: nologging, directio, noatime.
If more than one network interface card is used, make sure the network interrupts are not all going to the same core. Run the following script to disable interrupts:
allpsr=`/usr/sbin/psrinfo | grep -v off-line | awk '{ print $1 }'`
set $allpsr
numpsr=$#
while [ $numpsr -gt 0 ];
do
shift
numpsr=`expr $numpsr - 1`
tmp=1
while [ $tmp -ne 4 ];
do
/usr/sbin/psradm -i $1
shift
numpsr=`expr $numpsr - 1`
tmp=`expr $tmp + 1`
done
done
|
Put all network interfaces into a single group. For example:
$ifconfig ipge0 group webserver $ifconfig ipge1 group webserver |
In some cases, performance can be improved by using large page sizes. To start the 32–bit Web Server with 4 MB pages:
LD_PRELOAD_32=/usr/lib/mpss.so.1 ; export LD_PRELOAD_32; export MPSSHEAP=4M; ./bin/startserv; unset LD_PRELOAD_32; unset MPSSHEAP
For 64–bit servers:
LD_PRELOAD_64=/usr/lib/64/mpss.so.1; export LD_PRELOAD_64; export MPSSHEAP=4M; ./bin/startserv; unset LD_PRELOAD_64; unset MPSSHEAP