Linux核心調優

來源:互聯網
上載者:User
Linux核心調優

    kernel.shmall = 268435456

    net.ipv4.tcp_syncookies = 1

    net.ipv4.tcp_tw_reuse = 1

    net.ipv4.tcp_tw_recycle = 1

    net.ipv4.tcp_fin_timeout = 30

    net.ipv4.tcp_keepalive_time = 1200

    net.ipv4.ip_local_port_range = 1024 65000

    net.ipv4.tcp_max_tw_buckets = 5000

    net.ipv4.tcp_max_tw_buckets = 5000

    net.ipv4.tcp_fin_timeout = 30

    net.ipv4.tcp_keepalive_time = 300

    net.ipv4.tcp_syncookies = 1

    net.ipv4.tcp_tw_reuse = 1

    net.ipv4.tcp_tw_recycle = 1

  net.ipv4.ip_local_port_range = 5000 65000

    net.ipv4.tcp_mem = 786432 1048576 1572864

    net.core.wmem_max = 873200

    net.core.rmem_max = 873200

    net.ipv4.tcp_wmem = 8192 436600 873200

    net.ipv4.tcp_rmem = 32768 436600 873200

    net.core.somaxconn = 256

    net.core.netdev_max_backlog = 1000

    net.ipv4.tcp_max_syn_backlog = 2048

    net.ipv4.tcp_retries2 = 5

    net.ipv4.tcp_keepalive_time = 500

    net.ipv4.tcp_keepalive_intvl = 30

    net.ipv4.tcp_keepalive_probes = 3

    net.ipv4.conf.lo.arp_ignore = 0

    net.ipv4.conf.lo.arp_announce = 0    

    net.ipv4.conf.all.arp_ignore = 0

    net.ipv4.conf.all.arp_announce = 0

  

 

幾個解釋:

    net.ipv4.tcp_syncookies = 1

    #表示開啟SYN Cookies。當出現SYN等待隊列溢出時,啟用cookies來處理,可防範少量SYN攻擊,預設為0,表示關閉;

    net.ipv4.tcp_tw_reuse = 1

    #表示開啟重用。允許將TIME-WAIT sockets重新用於新的TCP串連,預設為0,表示關閉;

    net.ipv4.tcp_tw_recycle = 1

    #表示開啟TCP串連中TIME-WAIT sockets的快速回收,預設為0,表示關閉。

    net.ipv4.tcp_fin_timeout = 30

    #表示如果通訊端由本端要求關閉,這個參數決定了它保持在FIN-WAIT-2狀態的時間。

    net.ipv4.tcp_keepalive_time = 1200

    #表示當keepalive起用的時候,TCP發送keepalive訊息的頻度。預設是2小時,改為20分鐘。

    net.ipv4.ip_local_port_range = 1024    65000

    #表示用於向外串連的連接埠範圍。預設情況下很小:32768到61000,改為1024到65000。

    net.ipv4.tcp_max_tw_buckets = 5000

    #表示系統同時保持TIME_WAIT通訊端的最大數量,如果超過這個數字,

    #TIME_WAIT通訊端將立刻被清除並列印警告資訊。預設為180000,改為5000。

    #對於Apache、Nginx等伺服器,上幾行的參數可以很好地減少TIME_WAIT通訊端數量,

    #但是對於Squid,效果卻不大。此項參數可以控制TIME_WAIT通訊端的最大數量,避免Squid伺服器被大量的TIME_WAIT通訊端拖死。

 

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.