Setting up the server

This chapter proposed changes to various kernel parameters. The changes were executed for each key using the sysctl command. The sysctl-w command was executed to write back changes made to the behavior until the next reboot. In order to make the change persistent across the machine reboot, the respective key-value pairs must be updated in the /etc/sysctl.conf file. The file can then be reloaded using the sysctl-p command to apply the configuration changes.

The following configuration sums up all the changes proposed in the chapter:

# TCP Stack changes 
net.core.rmem_max = 16777216 
net.ipv4.tcp_rmem = 4096 87380 16777216 
net.core.wmem_max = 16777216 
net.ipv4.tcp_wmem = 4096 16384 16777216 
net.ipv4.tcp_fin_timeout = 20 
net.ipv4.tcp_tw_reuse = 1 
net.core.netdev_max_backlog = 10000 
net.ipv4.ip_local_port_range = 15000 65000
net.core.somaxconn=2048

For the keys not mentioned in the preceding configuration, the kernels default values are good enough. If the kernel defaults do not match the proposed values, append the change to the preceding list. Reboot the machine to make sure that all changes to the configuration are picked up.

Tip

All the keys mentioned in this chapter are part of the Unix procfs under the /proc/sys directory. The /proc/sys directory contains directories representing the areas of the kernel, with each directory having files for the respective parameters. In order to know the value for a kernel parameter, for example, net.core.wmem_max, convert the key to a relative folder path under /proc/sys by replacing all dots (.) with slashes (/):

$ cat /proc/sys/net/core/wmem_max
16777216 

Values can also be written to these files via the sudo command:

$ sudo bash -c 'echo 16777216 > /proc/sys/net/core/wmem_max'

The modifications done in this manner are temporary, and sysctl should be used to permanently modify the values.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.146.176.88