GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • All gists
  • Back to GitHub
  • Sign in
  • Sign up
  • Code
  • Revisions 1
  • Stars 80
  • Forks 37
  • Terms
  • Privacy
  • Security
  • Status
  • Community
  • Docs

This view

  • Original page
  • New address

GeezerVison is showing gist.github.com — Linux kernel tuning settings for large number of concurrent clients

Instantly share code, notes, and snippets.

@kfox

kfox/sysctl.conf

Created February 29, 2012 17:32
Show Gist options
  • Download ZIP
  • Star 80 (80) You must be signed in to star a gist
  • Fork 37 (37) You must be signed in to fork a gist
  • Clone this repository at <script src="https://gist.github.com/kfox/1942782.js"></script>
  • Save kfox/1942782 to your computer and use it in GitHub Desktop.
Clone this repository at <script src="https://gist.github.com/kfox/1942782.js"></script>
Save kfox/1942782 to your computer and use it in GitHub Desktop.
Download ZIP
Linux kernel tuning settings for large number of concurrent clients
Raw
sysctl.conf
# 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 source route verification
net.ipv4.conf.default.rp_filter = 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
# 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
# cf. http://www.psc.edu/networking/projects/tcptune/#Linux
net.ipv4.ip_forward = 1
net.ipv4.neigh.default.gc_thresh1 = 4096
net.ipv4.neigh.default.gc_thresh2 = 8192
net.ipv4.neigh.default.gc_thresh3 = 16384
net.ipv4.neigh.default.gc_interval = 5
net.ipv4.neigh.default.base_reachable_time = 120
net.ipv4.neigh.default.gc_stale_time = 120
net.ipv4.neigh.default.base_reachable_time = 120
net.ipv4.neigh.default.gc_stale_time = 120
net.core.netdev_max_backlog = 262144
#net.core.rmem_default = 16777216
net.core.rmem_max = 108544
net.core.somaxconn = 262144
net.core.wmem_max = 108544
net.netfilter.nf_conntrack_max = 10000000
net.netfilter.nf_conntrack_tcp_timeout_established = 40
net.netfilter.nf_conntrack_tcp_timeout_close = 10
net.netfilter.nf_conntrack_tcp_timeout_close_wait = 10
net.netfilter.nf_conntrack_tcp_timeout_fin_wait = 10
net.netfilter.nf_conntrack_tcp_timeout_last_ack = 10
net.netfilter.nf_conntrack_tcp_timeout_syn_recv = 10
net.netfilter.nf_conntrack_tcp_timeout_syn_sent = 10
net.netfilter.nf_conntrack_tcp_timeout_time_wait = 10
net.ipv4.tcp_fin_timeout = 1
net.ipv4.tcp_max_orphans = 262144
net.ipv4.tcp_max_syn_backlog = 16384
net.ipv4.tcp_max_syn_backlog = 262144
net.ipv4.tcp_rmem = 4096 87380 16777216
net.ipv4.tcp_sack = 0
net.ipv4.tcp_syn_retries = 2
net.ipv4.tcp_synack_retries = 2
net.ipv4.tcp_syncookies = 0
net.ipv4.tcp_timestamps = 0
net.ipv4.tcp_tw_recycle = 1
net.ipv4.tcp_wmem = 4096 16384 16777216
@ck-on

ck-on commented Aug 7, 2013

Copy link
Copy Markdown

You repeat net.ipv4.tcp_max_syn_backlog twice.
And you cannot use a value over 65535 for that setting anyway, it's in the kernel.

Watch this for more insight: http://vimeo.com/70369211
Slides http://cdn.oreillystatic.com/en/assets/1/event/94/Tuning%20TCP%20For%20The%20Web%20Presentation.pdf

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ruseel

ruseel commented Oct 2, 2015

Copy link
Copy Markdown

thank you @ck-on @kfox.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@t2krew

t2krew commented Oct 7, 2016 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

net.ipv4.tcp_max_syn_backlog twice

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ginnun

ginnun commented May 10, 2017 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Be careful, do not blindly copy/paste this configurations.
For example, you should carefully consider net.ipv4.tcp_tw_recycle = 1
check: https://vincent.bernat.im/en/blog/2014-tcp-time-wait-state-linux

Also net.ipv4.tcp_syncookies = 0 means just hiding problems.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@nikolaydimitrov

nikolaydimitrov commented Jun 13, 2017

Copy link
Copy Markdown

I can confirm tcp_tw_recycle=1 can cause problems when server being behind NAT

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@jonixmobile

jonixmobile commented Aug 3, 2017

Copy link
Copy Markdown

the option tcp_tw_recycle casuse problems with multiples connections behind a IP address.
you can use tcp_tw_reuse without problems.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@TinaSummer

TinaSummer commented Sep 20, 2018

Copy link
Copy Markdown

hello, "net.netfilter.nf_conntrack_tcp_timeout_fin_wait" means what ? What's the different between "net.netfilter.nf_conntrack_tcp_timeout_fin_wait" and net.ipv4.tcp_fin_timeout?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.