Common parameters modification of Linux Server

Source: Internet
Author: User

Document descriptor (file descriptors)

/etc/security/limits.conf
Here is the file descriptor limit that the current user allows to open, which can be ulimit -n viewed.
Modify the configuration as follows:

    1. * hard nofile 65536
    2. root hard nofile 65536
    3. * soft nofile 65536
    4. root soft nofile 65536

Note: Root and * must be written, this * represents a different account than root (the pit is correct)
Log off and re-login in effect.

Maximum number of connections (max connections)

/etc/sysctl.conf
Here you can set the system's total file descriptor limit (all users), as well as other TCP-related settings.
The maximum number of connections is net.core.somaxconn that this parameter is inconsistent in different Linux cores, so you can set it two times and use a different upper limit.

  1. fs.file-max=102400
  2. net.ipv4.tcp_slow_start_after_idle = 0
  3. net.core.somaxconn = 65535
  4. net.ipv4.tcp_keepalive_time=300
  5. net.ipv4.tcp_tw_reuse=1
  6. net.ipv4.tcp_tw_recycle=1
  7. net.ipv4.tcp_no_metrics_save=1
  8. net.core.somaxconn=262144
  9. net.ipv4.tcp_max_orphans=262144
  10. net.ipv4.tcp_synack_retries=2
  11. net.ipv4.tcp_syn_retries=2
  12. net.ipv4.tcp_syncookies=0
  13. net.ipv4.tcp_max_syn_backlog=262144
  14. net.core.wmem_max=16777216
  15. net.core.rmem_max=16777216
  16. net.ipv4.tcp_wmem=4096 4096 16777216
  17. net.ipv4.tcp_mem = 786432 2097152 3145728
  18. net.ipv4.tcp_rmem=4096 4096 16777216
  19. net.core.netdev_max_backlog=30000
  20. net.ipv4.ip_local_port_range=5000 65535
  21. net.ipv4.tcp_fin_timeout=30
  22. net.core.rmem_default = 262144
  23. net.core.wmem_default = 262144
  24. net.core.netdev_max_backlog=16384
  25. net.core.rmem_max=16777216
  26. net.core.wmem_max=16777216
  27. net.ipv4.tcp_syncookies=1

After modification, the use sysctl -p takes effect.

Note that after the above modifications are complete, many services must be restarted to take effect.

Common parameters modification of Linux Server

Related Article

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.