GithubHelp home page GithubHelp logo

magictcp's Introduction

magicTCP

This script aims to optimise TCP performance between two hosts.

Usage

bash <(curl -sSL https://raw.githubusercontent.com/nexstorm/magicTCP/main/main.sh)

Minimum requirements

  • Debian 11
  • 500MB of free disk space
  • 1GB of RAM

What this script does

magicTCP kernel

This is a kernel that is optimised for TCP throughput. It is based on (usually) the latest LTS kernel with patches that optimise parts of the kernel and enable some of the tweaks used.

Tuning TCP via sysctl.conf

We apply the following changes to your sysctl file when you run the script

net.ipv4.tcp_rmem = 8192 262144 536870912
net.ipv4.tcp_wmem = 8192 262144 536870912
net.ipv4.tcp_adv_win_scale = -2
net.ipv4.tcp_collapse_max_bytes = 6291456
net.ipv4.tcp_notsent_lowat = 131072
net.ipv4.tcp_window_scaling = 1
net.core.default_qdisc = fq
net.ipv4.tcp_congestion_control = bbr
  1. net.ipv4.tcp_rmem = 8192 262144 536870912

    This line specifies the minimum, default, and maximum receive socket buffer sizes for TCP connections. Increasing buffer sizes can help improve performance for high-throughput applications.

  2. net.ipv4.tcp_wmem = 8192 262144 536870912

    Similar to the previous line, this one sets the minimum, default, and maximum send socket buffer sizes for TCP connections. Increasing these values can allow for larger send buffers, improving the performance of applications that send data over TCP.

  3. net.ipv4.tcp_adv_win_scale = -2

    Set to 0.25x of memory in the receive buffer to account for the overhead when processing packets. -2 is used to reduce the frequency of TCP collapse

  4. net.ipv4.tcp_collapse_max_bytes = 6291456

    From Cloudflare's blog

  5. net.ipv4.tcp_notsent_lowat = 131072

    This sets the low-water mark for the amount of unsent data in TCP sockets. Raising this threshold can reduce the number of small packets sent.

  6. net.ipv4.tcp_window_scaling = 1

    Enables TCP window scaling

  7. net.core.default_qdisc = fq

    Uses fair-queue as the queuing discipline

  8. net.ipv4.tcp_congestion_control = bbr

    Uses BBR as the CCA. BBR is a Google algorithm that generally has the best throughput. We use it basically because it is unfairly aggressive.

This script also does some tuning to UDP and also enables forwarding.

magictcp's People

Contributors

nexstorm avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.