ÔõÑùʹÓÃLinux¾ÙÐÐÍøÂçÐÔÄܵ÷ÓÅ
ÔõÑùʹÓÃlinux¾ÙÐÐÍøÂçÐÔÄܵ÷ÓÅ
ÍøÂçÐÔÄÜÊÇÅÌËã»úÍøÂçÖÐÒ»¸öºÜÊÇÖ÷ÒªµÄÖ¸±ê£¬ËüÖ±½Ó¹Øϵµ½Óû§µÄÍøÂçÌåÑé¡£ÔÚLinuxϵͳÖУ¬ÎÒÃÇ¿ÉÒÔͨ¹ýһЩ¼òÆÓµÄÍøÂçÐÔÄܵ÷ÓÅÀ´ÌáÉýÍøÂçµÄ´«ÊäËÙÂʺÍÎȹÌÐÔ¡£±¾ÎĽ«ÏÈÈݳ£¼ûµÄLinuxÍøÂçÐÔÄܵ÷ÓÅÒªÁ죬²¢Ìṩ´úÂëʾÀý¡£
MTUµ÷½â
MTUÊÇÍøÂç´«ÊäÖÐ×î´ó´«Ê䵥λµÄËõд£¬ËüÌåÏÖÒ»´ÎÍøÂç´«ÊäµÄ×î´óÊý¾Ý°ü¾Þϸ¡£Ä¬ÈÏÇéÐÎÏ£¬LinuxϵͳµÄMTU¾ÞϸÊÇ1500×Ö½Ú£¬µ«ÔÚijЩÇéÐÎÏ£¬Õâ¿ÉÄܲ»·ó´ó£¬µ¼ÖÂÍøÂç´«ÊäЧÂʵÍÏ¡£
ͨ¹ýµ÷½âMTU¾Þϸ£¬ÎÒÃÇ¿ÉÒÔÌá¸ßÍøÂç´«ÊäЧÂÊ¡£ÏÂÃæÊÇÒ»¸öʾÀý´úÂ룬ÓÃÓÚµ÷½âÍøÂç½Ó¿Úeth0µÄMTU¾ÞϸΪ9000×Ö½Ú£º
sudo ifconfig eth0 mtu 9000
µÇ¼ºó¸´ÖÆ
TCPÅþÁ¬µ÷ÓÅ
TCPÊÇ×î³£ÓõÄÍøÂç´«ÊäÐÒéÖ®Ò»£¬ÔÚLinuxϵͳÖУ¬ÎÒÃÇ¿ÉÒÔͨ¹ýµ÷½âTCPÅþÁ¬²ÎÊýÀ´Ìá¸ßÍøÂçÐÔÄÜ¡£ÏÂÃæÊÇһЩ³£ÓõÄTCPÅþÁ¬µ÷ÓŲÎÊý¼°ÆäʾÀý´úÂ룺
µ÷½âTCP´°¿Ú¾Þϸ
sudo sysctl -w net.ipv4.tcp_window_scaling=1 sudo sysctl -w net.core.rmem_max=8388608 sudo sysctl -w net.core.wmem_max=8388608 sudo sysctl -w net.core.rmem_default=65535 sudo sysctl -w net.core.wmem_default=65535
µÇ¼ºó¸´ÖÆ
¿ªÆô¿ìËÙÖØ´«ºÍ¿ìËÙ»Ö¸´
sudo sysctl -w net.ipv4.tcp_sack=1 sudo sysctl -w net.ipv4.tcp_fack=1 sudo sysctl -w net.ipv4.tcp_congestion_control=cubic
µÇ¼ºó¸´ÖÆ
µ÷½âTCPÅþÁ¬³¬Ê±Ê±¼ä
sudo sysctl -w net.ipv4.tcp_keepalive_time=120
µÇ¼ºó¸´ÖÆ
IP·Óɵ÷ÓÅ
IP·ÓÉÊÇÍøÂçͨѶÖкÜÊÇÖ÷ÒªµÄÒ»»·£¬Í¨¹ýµ÷½âIP·ÓÉ±í£¬ÎÒÃÇ¿ÉÒÔÌá¸ßÍøÂç´«ÊäЧÂÊ¡£ÏÂÃæÊÇһЩ³£ÓõÄIP·Óɵ÷ÓŲÎÊý¼°ÆäʾÀý´úÂ룺
¹Ø±ÕIPת·¢
sudo sysctl -w net.ipv4.ip_forward=0
µÇ¼ºó¸´ÖÆ
¿ªÆôÔ´µØµãÑéÖ¤
sudo sysctl -w net.ipv4.conf.all.rp_filter=1
µÇ¼ºó¸´ÖÆ
¿ªÆôIP·ÓÉ»º´æ
sudo sysctl -w net.ipv4.route.flush=1
µÇ¼ºó¸´ÖÆ
ϵͳ×ÊÔ´µ÷ÓÅ
³ýÁËÉÏÊöÍøÂçÐÔÄܵ÷ÓÅÒªÁìÍ⣬ÎÒÃÇ»¹¿ÉÒÔͨ¹ýµ÷½âϵͳ×ÊÔ´À´Ìá¸ßÍøÂçÐÔÄÜ¡£ÏÂÃæÊÇһЩ³£ÓõÄϵͳ×ÊÔ´µ÷ÓŲÎÊý¼°ÆäʾÀý´úÂ룺
µ÷½âÎļþÐÎò·ûÏÞÖÆ
sudo ulimit -n 65535
µÇ¼ºó¸´ÖÆ
µ÷½âÄں˲ÎÊý
sudo sysctl -w net.core.netdev_max_backlog=30000 sudo sysctl -w net.ipv4.tcp_max_syn_backlog=8192 sudo sysctl -w net.core.somaxconn=4096
µÇ¼ºó¸´ÖÆ
ͨ¹ýÒÔÉϵÄÍøÂçÐÔÄܵ÷ÓÅÒªÁ죬ÎÒÃÇ¿ÉÒÔ´ó´óÌáÉýLinuxϵͳµÄÍøÂçÐÔÄÜ£¬Ìá¸ßÍøÂç´«ÊäËÙÂʺÍÎȹÌÐÔ¡£ËäÈ»£¬ÏêϸµÄµ÷ÓÅÒªÁìºÍ²ÎÊýÐèҪƾ֤ÏÖÕæÏàÐξÙÐУ¬²î±ðµÄ³¡¾°¿ÉÄÜÓвî±ðµÄÓÅ»¯¼Æ»®¡£
×ܽá
±¾ÎÄÏÈÈÝÁËÔõÑùʹÓÃlinux¾ÙÐÐÍøÂçÐÔÄܵ÷ÓÅ£¬²¢ÌṩÁËÏìÓ¦µÄ´úÂëʾÀý¡£Í¨¹ýµ÷½âMTU¾Þϸ¡¢TCPÅþÁ¬²ÎÊý¡¢IP·ÓɲÎÊýÒÔ¼°ÏµÍ³×ÊÔ´£¬ÎÒÃÇ¿ÉÒÔÌá¸ßLinuxϵͳµÄÍøÂçÐÔÄÜ£¬ÌáÉýÍøÂç´«ÊäËÙÂʺÍÎȹÌÐÔ¡£Í¬Ê±£¬ÐèҪƾ֤ÏêϸÇéÐξÙÐе÷ÓÅ£¬ÒÔ»ñµÃ×î¼ÑµÄÍøÂçÐÔÄÜЧ¹û¡£
ÒÔÉϾÍÊÇÔõÑùʹÓÃLinux¾ÙÐÐÍøÂçÐÔÄܵ÷ÓŵÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡