시스템 매개 변수 최적화

3110 단어 Nginxweb
시스템 매개 변수 최적화

Linux , Web , , Nginx web 、 , , 、 Nginx TCP , /etc/sysctl.conf 。

  • net.ipv4.ip_nonlocal_bind = 1
    # IP socket

  • net.ipv4.ip_forward = 1
    # IPv4

  • net.ipv4.tcp_timestamps = 0
    #

  • net.ipv4.tcp_tw_reuse = 0
    #

  • net.ipv4.tcp_tw_recycle = 0
    # TIME_WAIT , TIME_OUT

  • fs.file-max = 1000000
    #

  • net.ipv4.tcp_tw_reuse = 1
    # 1 , TIME_WAIT socket TCP , , TIME_WAIT

  • net.ipv4.tcp_keepalive_time = 600
    # keepalive ,TCP keepalive ; 2 , 10 ,

  • net.ipv4.tcp_fin_timeout = 30
    # ,socket FIN_WAIT_2

  • net.ipv4.tcp_max_tw_buckets = 5000
    # TIME_WAIT , ,TIME_WAIT , 8000, TIME_WAIT Web

  • net.ipv4.ip_local_port_range = 1024 65000
    # UDP TCP

  • net.ipv4.tcp_rmem = 10240 87380 12582912
    # TCP socket 、 、

  • net.ipv4.tcp_wmem = 10240 87380 12582912
    # TCP 、 、

  • net.core.netdev_max_backlog = 8096
    # , 。

  • net.core.rmem_default = 6291456
    #

  • net.core.wmem_default = 6291456
    #

  • net.core.rmem_max = 12582912
    #

  • net.core.wmem_max = 12582912
    #
    : ,

  • net.ipv4.tcp_syncookies = 1
    # 。 TCP SYN

  • net.ipv4.tcp_max_syn_backlog = 8192
    # TCP SYN , 1024, Nginx accept ,Linux

  • net.ipv4.tcp_tw_recycle = 1
    # timewait

  • net.core.somaxconn=262114
    # 128, TCP , , , 。

  • net.ipv4.tcp_max_orphans=262114
    # TCP 。 , 。 DOS , ,

좋은 웹페이지 즐겨찾기