Tuning TCP for Linux 2.4 and 2.6
Tuning TCP for Linux 2.4 and 2.6
NB: Recent versions of Linux (version 2.6.17 and later) have full autotuning with 4 MB maximum buffer sizes. Except in some rare cases, manual tuning is unlikely to substantially improve the performance of these kernels over most network paths, and is not generally recommended
Since autotuning and large default buffer sizes were released progressively over a succession of different kernel versions, it is best to inspect and only adjust the tuning as needed. When you upgrade kernels, you may want to consider removing any local tuning.
All system parameters can be read or set by accessing special files in the /proc file system. E.g.:
1
cat /proc/sys/net/ipv4/tcp_moderate_rcvbuf
If the parameter tcp_moderate_rcvbuf is present and has value 1 then autotuning is in effect. With autotuning, the receiver buffer size (and TCP window size) is dynamically updated (autotuned) for each connection. (Sender side autotuning has been present and unconditionally enabled for many years now).
The per connection memory space defaults are set with two 3 element arrays:
1
2
/proc/sys/net/ipv4/tcp_rmem - memory reserved for TCP rcv buffers
/proc/sys/net/ipv4/tcp_wmem - memory reserved for TCP snd buffers
These are arrays of three values: minimum, initial and maximum buffer size. They are used to set the bounds on autotuning and balance memory usage while under memory stress. Note that these are controls on the actual memory usage (not just TCP window size) and include memory used by the socket data structures as well as memory wasted by short packets in large buffers. The maximum values have to be larger than the BDP of the path by some suitable overhead.
With autotuning, the middle value just determines the initial buffer size. It is best to set it to some optimal value for typical small flows. With autotuning, excessively large initial buffer waste memory and can even hurt performance.
If autotuning is not present (Linu
Ïà¹ØÎĵµ£º
Linuxϳ£ÓÃѹËõ¸ñʽµÄѹËõÓë½âѹ·½·¨
½â°ü£ºtar xvf FileName.tar
´ò°ü£ºtar cvf FileName.tar DirName
£¨×¢£ºtarÊÇ´ò°ü£¬²»ÊÇѹËõ£¡£©
---------------------------------------------
.gz
½âѹ1£ºgunzip FileName.gz
½âѹ2£ºgzip -d FileName.gz
ѹËõ£ºgzip FileName
.tar.gz
½âѹ£ºtar zxvf FileName.tar. ......
1£® ÅäÖÃϵͳµÄ»ù±¾½á¹¹
LinuxÄں˵ÄÅäÖÃϵͳÓÉÈý¸ö²¿·Ö×é³É£¬·Ö±ðÊÇ£º
Makefile£º·Ö²¼ÔÚ Linux ÄÚºËÔ´´úÂëÖÐµÄ Makefile£¬¶¨Òå Linux Äں˵ıàÒë¹æÔò£»
ÅäÖÃÎļþ£¨config.in£©£º¸øÓû§ÌṩÅäÖÃÑ¡ÔñµÄ¹¦ÄÜ£»
ÅäÖù¤¾ß£º°üÀ¨ÅäÖÃÃüÁî½âÊÍÆ÷£¨¶ÔÅäÖýű¾ÖÐʹÓõÄÅäÖÃÃüÁî½øÐнâÊÍ£©ºÍÅäÖÃÓû§½çÃ棨Ìṩ»ùÓÚ×Ö·û½çÃæ¡ ......
“/”¸ùĿ¼
°üº¬»ù±¾µÄ²Ù×÷ϵͳºÍά»¤¹¤¾ß¡£Õâ¸öĿ¼µÄÎļþ¿ÉÒÔÆô¶¯ÏµÍ³£¬²¢ÇÒÐèÒªµÄ»°£¬¿ÉÒÔÍê³É½ô¼±Î¬»¤ºÍÐÞ¸´µÄ¹¦ÄÜ¡£
“/usr”Ŀ¼
°üº¬ËùÓеÄÃüÁî¡¢³ÌÐò¿â¡¢ÎĵµºÍÆäËüÎļþ¡£ÕâЩÎļþÔÚÕý³£²Ù×÷Öв»»á±»¸Ä±äµÄ¡£
Õâ¸öĿ¼Ҳ°üº¬ÄãµÄLinux·¢Ðа汾µÄÖ÷ÒªµÄÓ¦ÓóÌÐò£¬Æ©È磬Netscape¡£
&ldquo ......
ÔÚLinuxϲ鿴ApacheµÄ¸ºÔØÇé¿ö£¬ÒÔǰҲ˵¹ý£¬×î¼òµ¥ÓÐÓÐЧµÄ·½Ê½¾ÍÊDz鿴Apache Server Status
£¨ÈçºÎ¿ªÆôApache Server Status
µãÕâÀ£¬ÔÚûÓÐ
¿ªÆôApache Server StatusµÄÇé¿öÏ£¬»ò°²×°µÄÊÇÆäËûµÄWeb Server£¬±ÈÈçNginxµÄʱºò£¬ÏÂÃæµÄÃüÁî¾ÍÌåÏÖ³ö×÷ÓÃÁË¡£
ps -ef|grep httpd|wc -l
ÃüÁî
#ps
-ef|grep httpd| ......
Linux»·¾³ÏµÄÈí¼þ°²×°£¬²¢²»ÊÇÒ»¼þÈÝÒ×µÄÊÂÇé;Èç¹ûͨ¹ýÔ´´úÂë±àÒëºóÔÚ°²×°£¬µ±È»ÊÂÇé¾Í¸üΪ¸´ÔÓһЩ;ÏÖÔÚ°²×°¸÷ÖÖÈí¼þµÄ½Ì³Ì¶¼·Ç³£ÆÕ±é;µ«
Íò±ä²»ÀëÆäÖУ¬¶Ô»ù´¡ÖªÊ¶µÄÔúʵÕÆÎÕ£¬°²×°¸÷ÖÖÈí¼þµÄÎÊÌâ¾ÍÓÈжø½âÁË¡£Configure½Å±¾ÅäÖù¤¾ß¾ÍÊÇ»ù´¡Ö®Ò»£¬ËüÊÇautoconfµÄ¹¤¾ßµÄ»ù±¾
Ó¦Óá£
ÓëһЩ¼¼ÇÉÏà±È£¬ConfigureÏԵûù ......