zoukankan      html  css  js  c++  java
  • linux 内核的优化

    修改下面的这些参数,如果没有的话。直接复制进去就可以了

    vim /etc/sysctl.conf 

    参数修改

    vm.swappiness = 0
    net.ipv4.neigh.default.gc_stale_time=120
    net.ipv4.conf.all.rp_filter=0
    net.ipv4.conf.default.rp_filter=0
    net.ipv4.conf.default.arp_announce = 2
    net.ipv4.conf.all.arp_announce=2
    net.ipv4.tcp_max_tw_buckets = 5000 #timewait的数量,默认是180000。
    net.ipv4.tcp_syncookies = 1 #开启SYN Cookies,当出现SYN等待队列溢出时,启用cookies来处理。
    net.ipv4.tcp_max_syn_backlog = 1024 #记录的那些尚未收到客户端确认信息的连接请求的最大值。对于有128M内存的系统而言,缺省值是1024,小内存的系统则是128。
    net.ipv4.tcp_synack_retries = 2 #为了打开对端的连接,内核需要发送一个SYN并附带一个回应前面一个SYN的ACK。也就是所谓三次握手中的第二次握手。这个设置决定了内核放弃连接之前发送SYN+ACK包的数量。
    net.ipv4.conf.lo.arp_announce=2
    fs.file-max=65535 #文件描述符,与ulimit -n一样大即可

    建议大家修改一下  ulimit 的 open files 数量

    /etc/sysctl.conf 常见优化参数如下(记得修改后要:sysctl –p):

     记录的配置

    # Kernel sysctl configuration file for Red Hat Linux # 
    # For binary values, 0 is disabled, 1 is enabled. See sysctl(8) and
    # sysctl.conf(5) for more details.
    # Controls IP packet forwarding net.ipv4.ip_forward = 0
    # Controls source route verification
    # Do not accept source routing net.ipv4.conf.default.accept_source_route = 0
    # Controls the System Request debugging functionality of the kernel kernel.sysrq = 0
    # Controls whether core dumps will append the PID to the core filename.
    # Useful for debugging multi-threaded applications. kernel.core_uses_pid = 1
    # Controls the use of TCP syncookies
    # Disable netfilter on bridges. net.bridge.bridge-nf-call-ip6tables = 0 net.bridge.bridge-nf-call-iptables = 0 net.bridge.bridge-nf-call-arptables = 0
    # Controls the default maxmimum size of a mesage queue kernel.msgmnb = 65536
    # Controls the maximum size of a message, in bytes kernel.msgmax = 65536
    # Controls the maximum shared segment size, in bytes kernel.shmmax = 68719476736
    # Controls the maximum number of shared memory segments, in pages kernel.shmall = 4294967296 vm.swappiness = 0 net.ipv4.neigh.default.gc_stale_time=120 net.ipv4.conf.all.rp_filter=0 net.ipv4.conf.default.rp_filter=0 net.ipv4.conf.default.arp_announce = 2 net.ipv4.conf.all.arp_announce=2 net.ipv4.tcp_max_tw_buckets = 5000
    #timewait的数量,默认是180000。 net.ipv4.tcp_syncookies = 1
    #开启SYN Cookies,当出现SYN等待队列溢出时,启用cookies来处理。
    net.ipv4.tcp_max_syn_backlog = 1024
    #记录的那些尚未收到客户端确认信息的连接请求的最大值。对于有128M内存的系统而言,缺省值是1024,小内存的系统则是128。 net.ipv4.tcp_synack_retries = 2
    #为了打开对端的连接,内核需要发送一个SYN并附带一个回应前面一个SYN的ACK。也就是所谓三次握手中的第二次握手。这个设置决定了内核放弃连接之前发送SYN+ACK包的数量。 net.ipv4.conf.lo.arp_announce=2 fs.file-max=65535
    #文件描述符,与ulimit -u 一样大即可
  • 相关阅读:
    一只小爬虫(转)
    easyui +ASP.NET 前后台乱码解决方法
    轻松搞定 easyui datagrid 二次加载的问题(转)
    easyui combobox默认选中项
    VS2010新建Web网站与新建Web应用程序的区别 (转)
    关于html+ashx开发中几个问题的解决方法 (转)
    如何使用.net访问Access数据库 (转)
    ACCESS的System.Data.OleDb.OleDbException: INSERT INTO 语句的语法错误
    Ajax 中正常使用jquery-easyui (转)
    会动的文字Marquee应用(转)
  • 原文地址:https://www.cnblogs.com/aqicheng/p/10299184.html
Copyright © 2011-2022 走看看