Performance and Tuning - The Network
This page details important network settings that may improve network performance when using Universal Messaging. Many of the commands detailed on this page are specific to Red Hat Linux, though many of the concepts apply globally to all operating systems.
Stop the iptables Service
The iptables service is used to control packet filtering and NAT. In many cases it is not necessary to run this service and a minor performance gain can be seen by disabling this service. To disable this service use the following command:
service iptables stop
service ip6tables stop
Disable Adaptive Interrupts on Network Interfaces
Interrupts on a network interface notify the system that some network task is required to be run, for example reading some data from the network. Adaptive Interrupts control the rate at which interrupts are generated for these tasks. The delay in processing subsequent interrupts from interrupt coalescing may degrade performance.
ethtool -C eth0 adaptive-rx off
Disabling adaptive interrupts on an interface will make that interface use the set interrupt rate. This rate will delay interrupts by a set number of microseconds. The minimum value that this delay can be is 0 (immediate). To set this value on an interface use the command:
ethttool -C eth0 rx-usecs-irq 0
Kernel Settings
The Kernel has many network settings for TCP which can provide performance improvements when correctly tweaked. This section will outline a few suggestions, however care should be taken when changing these parameters. It is also important to validate results as your mileage may vary. These settings should be added to the sysctl.conf file.
Increase Socket Memory
The settings below will increase the amount of memory allocated by the kernel to tcp sockets.
Important: | It is important to set these limits to a reasonable level for the amount of memory available on your machine. |
net.core.rmem_max = 16777216
net.core.wmem_max = 16777216
net.ipv4.tcp_rmem = 4096 87380 16777216
net.ipv4.tcp_wmem = 4096 65536 16777216
net.ipv4.tcp_mem = 50576 64768 98152
Increase Backlog Queue Size
The command below will increase the queue size in packets waiting to be processed by the kernel. This queue fills up when the interface receives packets faster than the kernel can process them.
net.core.netdev_max_backlog = 2500
Increase the local Port Range
Applications which have to manage large numbers of current connections may find that they will run out of ports under the default settings. This default can be increased by using the following command:
net.ipv4.ip_local_port_range = 1024 65535
The maximum number of allocated ports are 65535, 1024 of these are reserved. Applications which manage extremely high numbers of connections will require more ports than this. One way to get around these limits would be to create multiple virtual network interfaces.