Linux system optimized for high concurrency

Source: Internet
Author: User

Ulimit-shn 65535
Kernel Optimizations
Net.ipv4.ip_forward = 1 #开启路由功能
Net.ipv4.conf.default.rp_filter = 1 #禁用所有IP源路由
Net.ipv4.conf.default.accept_source_route = 0 #禁用icmp源路由选项
KERNEL.SYSRQ = 0 #关闭SysRq功能, SysRq represents the Magic System Request Key
Kernel.core_uses_pid = 1 #控制core文件的文件名是否添加pid作为扩展
net.ipv4.tcp_syncookies = 1 # TCP Syncookie, default off
KERNEL.MSGMNB = 65536 #默认的每个消息队列的最大尺寸 (byte), default is 16384
Kernel.msgmax = 65536 #消息队列中单条消息的最大尺寸 (byte), default 8192
Kernel.shmmax = 68719476736 #共享内存中的最大内存块尺寸 (byte), default 33554432 (32M), this is 65536M
Kernel.shmall = 4294967296 #kernel. Shmall unit is the number of pages, the current x86 system this unit is 4K, here is the total amount of 2048G shared memory, the default 2097152
Fs.file-max = 6553600 #系统级最大打开文件数, combined with limits.conf soft and hard limits
Net.ipv4.tcp_max_tw_buckets = #1st低于此值, tcp no memory pressure, 2nd into the memory pressure phase, 3rdTCP refused to allocate socket (in memory page)
Net.ipv4.tcp_sack = 1 #定义SYN重试次数
net.ipv4.tcp_window_scaling = 1 #开启窗口缩放功能
Net.ipv4.tcp_rmem = 4096 87380 4194304 #接受缓冲的大小: Min,default,max
Net.ipv4.tcp_wmem = 4096 16384 4194304 #socket的发送缓存区分配的MIN, Default,max
Net.ipv4.tcp_max_syn_backlog = 8192 #syn队列, default 1024,> 1280 may not work stably, need to modify kernel source parameters
Net.core.netdev_max_backlog = 32768 #进入包的最大设备队列. The default is 300, which is too low for heavy-duty servers and can be adjusted to 2000.
Net.core.somaxconn = The default parameter of the 32768 #listen (), the maximum number of pending requests. The default is 128. Increase this value for busy servers to help network performance
Net.core.wmem_default = 8388608 #表示套接字发送缓冲区大小的缺省值, overwrites the Defaul value of Net.ipv4.tcp_wmem
Net.core.rmem_default = 8388608 #表示套接字接收缓冲区大小的缺省值
Net.core.rmem_max = 16777216 #表示套接字接收缓冲区大小的最大值
Net.core.wmem_max = 16777216 #表示套接字发送缓冲区大小的最大值, overrides the Net.ipv4.tcp_wmem max value
Net.ipv4.tcp_timestamps = 0 #禁用时间戳, timestamps can avoid the winding of serial numbers
Net.ipv4.tcp_synack_retries = 2 #syn-ack handshake State Retry count, default 5, Syn-flood attack to 1 or 2
Net.ipv4.tcp_syn_retries = 2 #外向syn握手重试次数, default 4
Net.ipv4.tcp_tw_recycle = 1 #开启 fast recycle of time-wait sockets in TCP connection, default is 0, indicates off.
Net.ipv4.tcp_tw_reuse = 1 #开启重用. Allows time-wait sockets to be re-used for new TCP connections, which defaults to 0, which means shutdown;
Net.ipv4.tcp_mem = 94500000 915000000 927000000 #1低于此值, TCP has no memory pressure, 2 under this value, enter the memory pressure phase, 3 above this value, TCP refuses to allocate the socket. The above memory unit is the page
The Net.ipv4.tcp_max_orphans = 3276800# option is used to set the maximum number of TCP sockets in the system that are not associated to any one user file handle, and if this number is exceeded, the orphaned connection is immediately reset and a warning message is printed
Net.ipv4.tcp_fin_timeout = #修改系統默认的 Timeout time
Net.ipv4.tcp_keepalive_time = #表示当keepalive起用的时候, the frequency at which TCP sends keepalive messages. The default is 2 hours, which is changed to 5 minutes.
Net.ipv4.ip_local_port_range = 1024x768 65000 #表示用于向外连接的端口范围. By default, it is too narrow: 32768 to 61000, instead of 1024 to 65535.
Net.ipv4.ip_conntrack_max = 655360 #增大iptables状态跟踪表
net.ipv4.netfilter.ip_conntrack_tcp_timeout_established = #设置默认 TCP connection duration is 180 seconds

Linux system optimized for high concurrency

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.