sysctl.conf optimization

Source: Internet
Author: User

Sysctl.conf
    • Home/ Tutorials/ Linux/ sysctl.conf

Ubuntu Server out of box was not optimized to make full use of available hardware. This means "Out-of-box" setup might fail under high load.

So we need to tweak the system configuration for maximum concurrancy.

Sysctl Tweaks

Open

vim /etc/sysctl.conf

Add following towards bottom

# # # IMPROVE SYSTEM MEMORY MANAGEMENT # # # Increase size of file handles and inode Cachefs.file-max = 2097152# do less swap pingvm.swappiness = 10vm.dirty_ratio = 60vm.dirty_background_ratio = 2### General NETWORK SECURITY OPTIONS # # # # Times synacks for passive TCP connection.net.ipv4.tcp_synack_retries = allowed Local Port Rangenet.ipv4.ip_local_port_ Range = 65535# Protect against TCP time-waitnet.ipv4.tcp_rfc1337 = # Decrease the time default value for Tcp_fin_tim Eout connectionnet.ipv4.tcp_fin_timeout = 15# Decrease the time default value for connections to keep Alivenet.ipv4.tcp_ke Epalive_time = 300net.ipv4.tcp_keepalive_probes = 5NET.IPV4.TCP_KEEPALIVE_INTVL = 15### TUNING NETWORK PERFORMANCE # # # # Efault Socket Receive Buffernet.core.rmem_default = 31457280# Maximum socket Receive Buffernet.core.rmem_max = 12582912# D Efault socket Send Buffernet.core.wmem_default = 31457280# Maximum socket Send Buffernet.core.wmem_max = 12582912# increas E Number of incoming ConneCtionsnet.core.somaxconn = 65536# Increase number of incoming connections Backlognet.core.netdev_max_backlog = 65536# INC Rease The maximum amount of option memory Buffersnet.core.optmem_max = 25165824# Increase the maximum total buffer-space a llocatable# this was measured in units of pages (4096 bytes) Net.ipv4.tcp_mem = 65536 131072 262144net.ipv4.udp_mem = 65536 131072 262144# Increase the read-buffer space Allocatablenet.ipv4.tcp_rmem = 8192 87380 16777216net.ipv4.udp_rmem_min = 16 384# increase the Write-buffer-space Allocatablenet.ipv4.tcp_wmem = 8192 65536 16777216net.ipv4.udp_wmem_min = 16384# Inc Rease the tcp-time-wait buckets pool size to prevent simple DOS attacksnet.ipv4.tcp_max_tw_buckets = 1440000net.ipv4.tcp_t w_recycle = 1net.ipv4.tcp_tw_reuse = 1
Load changes

Run following command to the load changes to Sysctl.

sysctl -p
Useful SYSTCL Commands

This was added to main post after Ovidiu ' s comment.

Show all system parameters with their values (default or changed)

sysctl -A

Show values of parameters modified by

sysctl -p

Show value for a single parameterparameter-name

sysctl parameter-name

Change value to a single parameter parameter-name without editingsysctl.conf manually.

sysctl -w parameter-name=parameter-value

Above command would overwrite any previous modifications to parameter-name . Also, need to surround Parameter-value with quotes.

Related

I do not have the in-depth explanation for all parameters. Comments you somewhat.

You can check https://rtcamp.com/tutorials/linux/increase-open-files-limit/for more details aboutfs.file-max

Credits

We don't have the expertise to tweak Linux at such level. So following links helped. They differ from the configs as they offered some explanation about parameters which helped us understand what we is pic King and why!

    1. Http://klaver.it/linux/sysctl.conf
    2. Https://github.com/GoTux/Configs/blob/master/99-sysctl.conf

sysctl.conf optimization

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.