Linux Network Tuning LinuxÍøÂç»·¾³ÐÔÄÜÓÅ»¯µ÷Õû
Linux Network Tuning LinuxÍøÂç»·¾³ÐÔÄÜÓÅ»¯µ÷Õû
À´Ô´£ºcnbird2008µÄרÀ¸ ×÷Õߣº ·¢²¼Ê±¼ä£º2009-06-20 ±êÇ©£ºlinux linuxÐÔÄÜÓÅ»¯ linuxÅäÖÃ
(ÒÔǰдµÄ,µ±Ê±ÓõÄRH Linux AS5.)
ÈçÏÂÍøÂçÅäÖòÎÊýµ÷Õû,Ö÷ÒªÊÇÕë¶ÔÇëÇóѹÁ¦´óµÄLinux (2.6 kernel)·þÎñÆ÷¶øÑÔ.
Èç¹û·þÎñÆ÷ѹÁ¦²»´ó,ÄÇôά³ÖĬÈϼ´¿É.
ÏÂÊöÄÚÈÝÈ¡²ÄÓÚ"Performance Tuning For Linux Server"Ò»Êé.
$ /proc/sys/net/core/wmem_max
×î´ósocketдbuffer,¿É²Î¿¼µÄÓÅ»¯Öµ:873200
$ /proc/sys/net/core/rmem_max
×î´ósocket¶Ábuffer,¿É²Î¿¼µÄÓÅ»¯Öµ:873200
$ /proc/sys/net/ipv4/tcp_wmem
TCPдbuffer,¿É²Î¿¼µÄÓÅ»¯Öµ: 8192 436600 873200
$ /proc/sys/net/ipv4/tcp_rmem
TCP¶Ábuffer,¿É²Î¿¼µÄÓÅ»¯Öµ: 32768 436600 873200
$ /proc/sys/net/ipv4/tcp_mem
ͬÑùÓÐ3¸öÖµ,Òâ˼ÊÇ:
net.ipv4.tcp_mem[0]:µÍÓÚ´ËÖµ,TCPûÓÐÄÚ´æѹÁ¦.
net.ipv4.tcp_mem[1]:ÔÚ´ËÖµÏÂ,½øÈëÄÚ´æѹÁ¦½×¶Î.
net.ipv4.tcp_mem[2]:¸ßÓÚ´ËÖµ,TCP¾Ü¾ø·ÖÅäsocket.
ÉÏÊöÄڴ浥λÊÇÒ³,¶ø²»ÊÇ×Ö½Ú.
¿É²Î¿¼µÄÓÅ»¯ÖµÊÇ:786432 1048576 1572864
$ /proc/sys/net/core/netdev_max_backlog
½øÈë°üµÄ×î´óÉ豸¶ÓÁÐ.ĬÈÏÊÇ300,¶ÔÖظºÔØ·þÎñÆ÷¶øÑÔ,¸Ãֵ̫µÍ,¿Éµ÷Õûµ½1000.
$ /proc/sys/net/core/somaxconn
listen()µÄĬÈϲÎÊý,¹ÒÆðÇëÇóµÄ×î´óÊýÁ¿.ĬÈÏÊÇ128.¶Ô·±Ã¦µÄ·þÎñÆ÷,Ôö¼Ó¸ÃÖµÓÐÖúÓÚÍøÂçÐÔÄÜ.
¿Éµ÷Õûµ½256.
$ /proc/sys/net/core/optmem_max
socket bufferµÄ×î´ó³õʼ»¯Öµ,ĬÈÏ10K.
$ /proc/sys/net/ipv4/tcp_max_syn_backlog
½øÈëSYN°üµÄ×î´óÇëÇó¶ÓÁÐ.ĬÈÏ1024.¶ÔÖظºÔØ·þÎñÆ÷,Ôö¼Ó¸ÃÖµÏÔÈ»Óкô¦.
¿Éµ÷Õûµ½2048.
$ /proc/sys/net/ipv4/tcp_retries2
TCPʧ°ÜÖØ´«´ÎÊý,ĬÈÏÖµ15,Òâζ×ÅÖØ´«15´Î²Å³¹µ×·ÅÆú.¿É¼õÉÙµ½5,ÒÔ¾¡ÔçÊÍ·ÅÄÚºË×ÊÔ´.
$ /proc/sys/net/ipv4/tcp_keepalive_time
$ /proc/sys/net/ipv4/tcp_keepalive_intvl
$ /proc/sys/net/ipv4/tcp_keepalive_probes
Õâ3¸ö²ÎÊýÓëTCP KeepAliveÓйØ.ĬÈÏÖµÊÇ:
tcp_keepalive_time = 7200 seconds (2 hours)
tcp_keepalive_probes = 9
tcp_keepalive_intvl = 75 seconds
Òâ˼ÊÇÈç¹ûij¸öTCPÁ¬½ÓÔÚidle 2¸öСʱºó,Äں˲ŷ¢Æðprobe.
Èç¹ûprobe 9´Î(ÿ´Î75Ãë)²»³É¹¦,Äں˲ų¹µ×·ÅÆú,ÈÏΪ¸ÃÁ¬½ÓÒÑʧЧ.
¶
Ïà¹ØÎĵµ£º
ѧϰLinuxϵͳµÄʮһµã½¨Òé
2007.06.12 À´×Ô£ºlingfen1552.cublog.c¡¡ [Êղص½ÎÒµÄÍøÕª]
Ëæ×ÅLinuxÓ¦ÓõÄÀ©Õ¹Ðí¶àÅóÓÑ¿ªÊ¼½Ó´¥Linux£¬¸ù¾ÝѧϰWindwosµÄ¾ÑéÍùÍùÓÐһЩãȻµÄ¸Ð¾õ£º²»Öª´ÓºÎ´¦¿ªÊ¼Ñ§Æð¡£ÈçºÎµÃµ½Áª»ú°ïÖúºÍ˽ÓвÙ×÷ϵͳ²»Í¬£¬¸÷¸öLinuxµÄ·¢Ðа汾µÄ¼¼ÊõÖ§³ÖÊ ......
Íø¿¨µÄÉèÖÃ
¼ûÒÔÇ°µÄÎÄÕÂ
Ö÷»úÃûµÄÉèÖÃ:
/etc/sysconfig/network
NETWORKING=yes
NETWORKING_IPV6=yes
HOSTNAME=a100 ----->Ö÷»úÃû
smbÊÇSamba µÄÖ÷ÒªÆô¶¯·þÎñÆ÷£¬ÈÃÆäËü»úÆ÷ÄÜÖªµÀ´Ë»úÆ÷¹²ÏíÁËʲô£»
......
ÎļþϵͳµÄ×éÖ¯½á¹¹·ÖÎö£¬ÎÒÃÇÄÜ·ÖÎöʲôÄØ£¿Ò²¾ÍÊǵ±ÎÒÃÇÁÐ/Ŀ¼ʱ£¬Ëù¿´µ½µÄ/usr¡¢/etc ... ... /var
µÈĿ¼ÊÇ×öʲôÓõģ¬ÕâЩĿ¼ÊDz»ÊÇÓÐЩÌض¨µÄÓÃ;¡£ÎÞÂÛÄĸöÄĸö°æ±¾µÄLinuxϵͳ£¬¶¼ÓÐÕâЩĿ¼£¬ÕâЩĿ¼Ӧ¸ÃÊDZê×¼µÄ¡£µ±È»¸÷¸öLinux·¢Ðаæ
±¾Ò²»á´æÔÚһЩССµÄ²îÒ죬µ«×ÜÌåÀ´Ëµ£¬»¹ÊÇ´óÌå²î²»¶à¡£
Linux·¢Ðа ......
ÕªÒª
LinuxÔÚÏû·Ñµç×ÓÀà²úÆ·Öеõ½Á˹㷺ӦÓã¬ÓÉÓÚǶÈëʽÓû§¶ÔÓÚϵͳÆô¶¯ËٶȽÏΪÃô¸Ð£¬Òò´Ë¿ìËÙÆô¶¯¼¼ÊõÖð½¥³ÉΪÑо¿ºÍÓ¦ÓÃÖеÄÒ»¸öÖص㡣±¾ÎÄͨ¹ý¶ÔǶ
Èëʽ
LinuxµÄÆô¶¯Ê±ÐòºÍÖ÷ÒªÑÓʱÒòËصķÖÎö£¬Õë¶ÔÐÔµØ̽ÌÖÁËÔÚ¸÷¸öÆô¶¯½×¶Î½µµÍʱºÄµÄ¼¼Êõ£¬Öصã·ÖÎöÁËXIP¼¼ÊõºÍXIPÎļþϵͳ£¬²¢¸ø³öÁËÖ÷ÒªµÄʵÏÖ¹ý
³Ì¡£
¹Ø¼ü´ ......
¹ØÓÚwindowsÓëlinuxÖ®¼äÎļþ»¥´«
»·¾³£ºÓÐÁ½Ì¨Ö÷»ú
A£º192.168.2.109 OS£ºwindows xp
B£º192.168.2.113 OS£ºlinux £¨redhat5.3£©
Ä¿µÄ£ºÒªÊµÏÖÁ½Ì¨Ö÷»úÖ®¼äÎļþµÄ»¥´«¡£
±¾ÈËÔÚÍøÉÏ¿´¹ý¼¸ÖÖ·½·¨£¬ÓеÄÐèÒªµÚÈý·½Èí¼þ£¨±ÈÈ磺ÔÚWindows XPÏÂÓÃServ-uÈí¼þ¼ÜÉèÁËFTP·þÎñ ......