Skip to content

Instantly share code, notes, and snippets.

@matyunin
Last active June 7, 2024 06:05
Show Gist options
  • Save matyunin/c1ff76b73d2407f3434c to your computer and use it in GitHub Desktop.
Save matyunin/c1ff76b73d2407f3434c to your computer and use it in GitHub Desktop.

Revisions

  1. matyunin revised this gist Jan 14, 2015. 1 changed file with 18 additions and 1 deletion.
    19 changes: 18 additions & 1 deletion linux_tune.md
    Original file line number Diff line number Diff line change
    @@ -22,4 +22,21 @@ net.ipv4.tcp_max_orphans = 65536
    net.ipv4.tcp_fin_timeout = 10
    net.ipv4.tcp_low_latency = 1
    net.ipv4.tcp_syncookies = 0
    ```
    ```

    Solution on Linux is:

    ```bash
    echo 1 > /proc/sys/net/ipv4/tcp_tw_reuse
    echo 1 > /proc/sys/net/ipv4/tcp_tw_recycle
    ```

    This allow the OS to quickly reuse those TIME_WAIT TCP sockets.

    Solution on MacOSX is:

    ```bash
    sysctl -w net.inet.tcp.msl=1000
    ```

    Please note we never tested on Mac, but some people suggest this setting.
  2. matyunin revised this gist Jan 14, 2015. 1 changed file with 4 additions and 0 deletions.
    4 changes: 4 additions & 0 deletions linux_tune.md
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,9 @@
    ###Tuning

    ```bash
    $ netstat -nao | grep 8080 | grep TIME_WAIT | wc -l
    ```

    To achieve the top most performance you should tune the source server system limits:

    ```bash
  3. matyunin created this gist Jan 14, 2015.
    21 changes: 21 additions & 0 deletions linux_tune.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,21 @@
    ###Tuning

    To achieve the top most performance you should tune the source server system limits:

    ```bash
    net.ipv4.tcp_max_tw_buckets = 65536
    net.ipv4.tcp_tw_recycle = 1
    net.ipv4.tcp_tw_reuse = 0
    net.ipv4.tcp_max_syn_backlog = 131072
    net.ipv4.tcp_syn_retries = 3
    net.ipv4.tcp_synack_retries = 3
    net.ipv4.tcp_retries1 = 3
    net.ipv4.tcp_retries2 = 8
    net.ipv4.tcp_rmem = 16384 174760 349520
    net.ipv4.tcp_wmem = 16384 131072 262144
    net.ipv4.tcp_mem = 262144 524288 1048576
    net.ipv4.tcp_max_orphans = 65536
    net.ipv4.tcp_fin_timeout = 10
    net.ipv4.tcp_low_latency = 1
    net.ipv4.tcp_syncookies = 0
    ```