zoukankan      html  css  js  c++  java
  • Linux内核参数调优

    本人在实际工作经过总结,在调优上有一下参数值得使用,特此总结。当然有一些也参考了大佬们的经验所获

    系统资源优化

    #root账⼾的资源软限制和硬限制
    root soft core unlimited
    root hard core unlimited
    root soft nproc 1000000
    root hard nproc 1000000
    root soft nofile 1000000
    root hard nofile 1000000
    root soft memlock 32000
    root hard memlock 32000
    root soft msgqueue 8192000
    root hard msgqueue 8192000
    #其他账⼾的资源软限制和硬限制
    * soft core unlimited
    * hard core unlimited
    * soft nproc 1000000
    * hard nproc 1000000
    * soft nofile 1000000
    * hard nofile 1000000
    * soft memlock 32000
    * hard memlock 32000
    * soft msgqueue 8192000
    * hard msgqueue 8192000
    

    内核参数优化

    # Controls source route verification
    net.ipv4.conf.default.rp_filter = 1
    net.ipv4.ip_nonlocal_bind = 1
    net.ipv4.ip_forward = 1
    # 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
    #number of pid_max
    kernel.pid_max = 1000000
    # Controls the use of TCP syncookies
    net.ipv4.tcp_syncookies = 1
    # 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
    # TCP kernel paramater
    net.ipv4.tcp_mem = 786432 1048576 1572864
    net.ipv4.tcp_rmem = 4096 87380 4194304
    net.ipv4.tcp_wmem = 4096 16384 4194304
    net.ipv4.tcp_window_scaling = 1
    net.ipv4.tcp_sack = 1
    # socket buffer
    net.core.wmem_default = 8388608
    net.core.rmem_default = 8388608
    net.core.rmem_max = 16777216
    net.core.wmem_max = 16777216
    net.core.netdev_max_backlog = 262144
    net.core.somaxconn = 20480
    net.core.optmem_max = 81920
    # TCP conn
    net.ipv4.tcp_max_syn_backlog = 262144
    net.ipv4.tcp_syn_retries = 3
    net.ipv4.tcp_retries1 = 3
    net.ipv4.tcp_retries2 = 15
    # tcp conn reuse
    net.ipv4.tcp_timestamps = 0
    net.ipv4.tcp_tw_reuse = 0
    net.ipv4.tcp_tw_recycle = 0
    net.ipv4.tcp_fin_timeout = 1
    net.ipv4.tcp_max_tw_buckets = 20000
    net.ipv4.tcp_max_orphans = 3276800
    net.ipv4.tcp_synack_retries = 1
    net.ipv4.tcp_syncookies = 1
    # keepalive conn
    net.ipv4.tcp_keepalive_time = 300
    net.ipv4.tcp_keepalive_intvl = 30
    net.ipv4.tcp_keepalive_probes = 3
    net.ipv4.ip_local_port_range = 10001 65000
    # swap
    vm.overcommit_memory = 0
    vm.swappiness = 10
    
  • 相关阅读:
    sql 一对多变成一对多的最后一条记录的做法
    2.如何优化操作大数据量数据库(改善SQL语句)
    asp数据操作类DB
    4.如何优化操作大数据量数据库(几十万以上数据)(如何选择聚合索引)
    【转】asp中记录集对象的getrows和getstring用法
    用DB类写新闻系统1
    Apache+Tomcat配置负载均衡
    C# CAD 几何图形周围创建尽可能小的圆 使用 .NET 在 2D AutoCAD
    C# Cad 2007 工具栏 工具条创建
    C# Cad 拉伸 关键 GetStretchPoints MoveStretchPointsAt
  • 原文地址:https://www.cnblogs.com/FengGeBlog/p/13410115.html
Copyright © 2011-2022 走看看