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 一样大即可
  • 相关阅读:
    k3 cloud点击按钮单开单据
    k3 cloud _LK表字段代表的意思
    sql server根据触发器名称查看代码
    sql server中查询所有触发器已经对应的表名称
    面向架构编程
    领域设计:领域事件
    QApplication: No such file or directory 完美解决方案
    C++ GUI Qt4编程(第二版) 源代码 下载
    ArcMap进行天空开阔度(SVF)分析
    wpf 高性能自定义chart
  • 原文地址:https://www.cnblogs.com/aqicheng/p/10299184.html
Copyright © 2011-2022 走看看