{"id":955,"date":"2026-08-23T22:39:05","date_gmt":"2026-08-23T22:39:05","guid":{"rendered":"https:\/\/virtualserversvps.com\/blog\/?p=955"},"modified":"2026-08-23T22:39:05","modified_gmt":"2026-08-23T22:39:05","slug":"linux-kernel-parameters-vps-network-performance","status":"publish","type":"post","link":"https:\/\/virtualserversvps.com\/blog\/linux-kernel-parameters-vps-network-performance\/","title":{"rendered":"Linux Kernel Parameters to Tune for Better VPS Network Performance"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Your VPS network performance is governed by a set of kernel parameters that control how TCP connections are established, maintained, and terminated. The default values in most Linux distributions are tuned for general-purpose servers \u2014 not for the specific constraints of a virtualized environment. This guide covers the most impactful sysctl parameters for VPS network performance, what they do, and how to tune them safely.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Before You Start: Measure Your Baseline<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Never tune blindly. Before changing any kernel parameter, measure your current network performance. Record baseline latency, throughput, and connection counts so you can evaluate the impact of each change:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># Current sysctl values (save this for comparison)\nsudo sysctl -a | grep -E 'net.(core|ipv4|ipv6)' &gt; \/tmp\/sysctl-baseline.txt\n\n# Measure latency\nping -c 100 google.com | tail -3\n\n# Measure throughput (install iperf3 first)\niperf3 -c your-test-server\n\n# Check current connection state\nss -s<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">1. TCP Buffer Sizes: The Most Impactful Tuning<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">TCP buffer sizes control how much data the kernel buffers for each connection before the application reads it. Defaults are often too conservative for modern VPS networks with decent bandwidth but higher latency (typical of virtualized environments). The three key parameters form a &#8220;min, default, max&#8221; tuple:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># Increase TCP read\/write buffer auto-tuning range\nnet.core.rmem_max = 16777216\nnet.core.wmem_max = 16777216\nnet.ipv4.tcp_rmem = 4096 87380 16777216\nnet.ipv4.tcp_wmem = 4096 65536 16777216<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">What this does: <code>rmem_max<\/code> and <code>wmem_max<\/code> set the ceiling for per-socket buffer sizes. The <code>tcp_rmem<\/code> and <code>tcp_wmem<\/code> tuples set the minimum, default, and maximum. The kernel auto-tunes between the default and maximum based on connection conditions. Raising the max to 16 MB allows connections with high bandwidth-delay products to perform better, particularly for file transfers and streaming.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">2. TCP Congestion Control: BBR for Modern Networks<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The default CUBIC congestion control algorithm works well on wired networks but is suboptimal on VPS instances where bandwidth varies and packet loss is not always a sign of congestion. BBR (Bottleneck Bandwidth and Round-trip propagation time) is a model-based algorithm that performs significantly better on virtualized infrastructure:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># Enable BBR congestion control\nnet.core.default_qdisc = fq\nnet.ipv4.tcp_congestion_control = bbr\n\n# Verify it is active\nsysctl net.ipv4.tcp_congestion_control\n# Expected output: net.ipv4.tcp_congestion_control = bbr<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">BBR is especially effective on VPS hosts because it does not rely on packet loss as a congestion signal \u2014 it paces packets based on measured bandwidth and RTT, which is a better fit for environments where the hypervisor may introduce variable latency. Combined with the <code>fq<\/code> (fair queueing) qdisc, BBR can significantly improve throughput and reduce latency for most workloads.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">3. Connection Handling: Reducing Latency and Overhead<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Several parameters control how TCP handles connection establishment and teardown. These are especially important for web servers handling many short-lived connections:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># Enable TCP Fast Open (reduces latency on repeat connections)\nnet.ipv4.tcp_fastopen = 3\n\n# Enable window scaling (required for efficient high-latency links)\nnet.ipv4.tcp_window_scaling = 1\n\n# Reduce the time to reuse TIME_WAIT sockets\nnet.ipv4.tcp_tw_reuse = 1\n\n# Reduce the FIN-WAIT-2 timeout (default is 60 seconds)\nnet.ipv4.tcp_fin_timeout = 15<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">TCP Fast Open (TFO)<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">TFO allows data to be sent during the TCP handshake (SYN packet), saving one round trip on repeat connections. Setting <code>tcp_fastopen = 3<\/code> enables TFO for both client and server roles. The impact is most noticeable on HTTPS connections where the TLS handshake adds additional round trips. For a VPS behind a load balancer or CDN, TFO can shave 20-50 ms off the initial connection time.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Window Scaling and TIME_WAIT<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Window scaling is required for TCP windows larger than 64 KB \u2014 without it, the buffer increases above are pointless. <code>tcp_tw_reuse<\/code> allows the kernel to reuse connections in TIME_WAIT state for new outgoing connections, which prevents port exhaustion on busy servers. <code>tcp_fin_timeout<\/code> reduces how long the kernel waits for a FIN response before closing the connection.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">4. Backlog and Accept Queues<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">When a web server is under load, the kernel&#8217;s SYN backlog (the queue of half-open connections waiting for the handshake to complete) can fill up, causing connection refusals. Increase it for busy VPS instances:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># Maximum number of SYN-ACK retransmits (default 5, lower is faster rejection)\nnet.ipv4.tcp_synack_retries = 2\n\n# Maximum number of SYN retransmits (default 6)\nnet.ipv4.tcp_syn_retries = 3\n\n# Maximum length of the SYN backlog queue\nnet.core.somaxconn = 1024\n\n# Maximum number of packets queued on the input side\nnet.core.netdev_max_backlog = 5000<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">For a VPS running a web server, <code>somaxconn<\/code> should match or exceed the web server&#8217;s listen backlog setting. Nginx&#8217;s <code>listen<\/code> directive has a <code>backlog=<\/code> parameter that should be set in tandem with this kernel parameter.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">5. Memory Pressure and Connection Tracking<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Two kernel subsystems can become bottlenecks under network load: the socket memory pressure system and the conntrack table. On a small VPS with limited RAM, these settings prevent the kernel from using excessive memory for network connections:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># TCP memory pressure limits (pages, often 4 KB each)\n# Format: min, pressure, max\nnet.ipv4.tcp_mem = 65536 131072 262144\n\n# Connection tracking limits (adjust based on expected connections)\nnet.netfilter.nf_conntrack_max = 262144\nnet.netfilter.nf_conntrack_tcp_timeout_established = 86400\n\n# Enable TCP keepalive (detect dead connections faster)\nnet.ipv4.tcp_keepalive_time = 120\nnet.ipv4.tcp_keepalive_intvl = 30\nnet.ipv4.tcp_keepalive_probes = 3<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The <code>tcp_mem<\/code> values are in memory pages (usually 4,096 bytes). The <code>min<\/code> value is the threshold below which the kernel does not apply memory pressure; <code>pressure<\/code> is where it starts to throttle; <code>max<\/code> is the hard limit. For a 1-2 GB VPS, the values above provide a reasonable balance. For larger VPS instances, scale them proportionally.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">6. Applying the Changes Safely<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Apply all changes to <code>\/etc\/sysctl.d\/99-vps-network-tuning.conf<\/code> (a separate file keeps your custom settings organized and survives kernel updates):<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># \/etc\/sysctl.d\/99-vps-network-tuning.conf\n# TCP Buffer Tuning\nnet.core.rmem_max = 16777216\nnet.core.wmem_max = 16777216\nnet.ipv4.tcp_rmem = 4096 87380 16777216\nnet.ipv4.tcp_wmem = 4096 65536 16777216\n\n# Congestion Control\nnet.core.default_qdisc = fq\nnet.ipv4.tcp_congestion_control = bbr\n\n# Connection Handling\nnet.ipv4.tcp_fastopen = 3\nnet.ipv4.tcp_window_scaling = 1\nnet.ipv4.tcp_tw_reuse = 1\nnet.ipv4.tcp_fin_timeout = 15\n\n# Backlog and Accept Queues\nnet.core.somaxconn = 1024\nnet.core.netdev_max_backlog = 5000\nnet.ipv4.tcp_synack_retries = 2\nnet.ipv4.tcp_syn_retries = 3\n\n# Memory and Connection Tracking\nnet.ipv4.tcp_mem = 65536 131072 262144\nnet.ipv4.tcp_keepalive_time = 120\nnet.ipv4.tcp_keepalive_intvl = 30\nnet.ipv4.tcp_keepalive_probes = 3\nnet.netfilter.nf_conntrack_max = 262144<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Apply immediately:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo sysctl --system<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">7. Testing and Validation<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">After applying the changes, validate that the parameters are active and measure the improvement:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># Verify specific parameters\nsysctl net.ipv4.tcp_congestion_control\nsysctl net.core.rmem_max\nsysctl net.ipv4.tcp_fastopen\n\n# Re-run your baseline tests\nping -c 100 google.com | tail -3\niperf3 -c your-test-server\nss -s\n\n# Compare against the baseline you saved earlier<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">If you see a regression (e.g., higher latency or connection errors), revert individual parameters by commenting them out in the <code>.conf<\/code> file and running <code>sudo sysctl --system<\/code> again. Some providers have hypervisor-level network settings that override kernel parameters \u2014 if you see no improvement after tuning, check with your provider whether they apply any rate limiting or traffic shaping at the host level.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Summary of Recommended Settings<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Parameter<\/th><th>Default<\/th><th>Tuned<\/th><th>Benefit<\/th><\/tr><\/thead><tbody><tr><td><code>tcp_congestion_control<\/code><\/td><td>cubic<\/td><td>bbr<\/td><td>Better throughput on variable-latency links<\/td><\/tr><tr><td><code>tcp_rmem \/ wmem max<\/code><\/td><td>~6 MB<\/td><td>16 MB<\/td><td>Higher throughput on high-BDP connections<\/td><\/tr><tr><td><code>tcp_fastopen<\/code><\/td><td>1<\/td><td>3<\/td><td>Reduced latency on repeat connections<\/td><\/tr><tr><td><code>somaxconn<\/code><\/td><td>128<\/td><td>1024<\/td><td>Prevents connection drops under load<\/td><\/tr><tr><td><code>tcp_fin_timeout<\/code><\/td><td>60<\/td><td>15<\/td><td>Faster connection cleanup<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">These kernel parameter tunings are part of a broader VPS optimization strategy. For more on choosing a provider with the right network infrastructure for your workload, see the <a href=\"https:\/\/virtualserversvps.com\/#providers\">VPS provider comparison table<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Your VPS network performance is governed by a set of kernel parameters that control how TCP connections are established, maintained, and terminated. The default values in most Linux distributions are&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"iawp_total_views":0,"footnotes":""},"categories":[1],"tags":[],"class_list":["post-955","post","type-post","status-publish","format-standard","hentry","category-vps-guides-tutorials"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v26.1 (Yoast SEO v26.1) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Linux Kernel Parameters to Tune for Better VPS Network Performance - Virtual Servers VPS Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/virtualserversvps.com\/blog\/linux-kernel-parameters-vps-network-performance\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Linux Kernel Parameters to Tune for Better VPS Network Performance\" \/>\n<meta property=\"og:description\" content=\"Linux Kernel Parameters to Tune for Better VPS Network Performance\" \/>\n<meta property=\"og:url\" content=\"https:\/\/virtualserversvps.com\/blog\/linux-kernel-parameters-vps-network-performance\/\" \/>\n<meta property=\"og:site_name\" content=\"Virtual Servers VPS Blog\" \/>\n<meta property=\"article:published_time\" content=\"2026-08-23T22:39:05+00:00\" \/>\n<meta name=\"author\" content=\"Virtual-Servers-Vps-Editor\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Virtual-Servers-Vps-Editor\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/virtualserversvps.com\/blog\/linux-kernel-parameters-vps-network-performance\/\",\"url\":\"https:\/\/virtualserversvps.com\/blog\/linux-kernel-parameters-vps-network-performance\/\",\"name\":\"Linux Kernel Parameters to Tune for Better VPS Network Performance - Virtual Servers VPS Blog\",\"isPartOf\":{\"@id\":\"https:\/\/virtualserversvps.com\/blog\/#website\"},\"datePublished\":\"2026-08-23T22:39:05+00:00\",\"author\":{\"@id\":\"https:\/\/virtualserversvps.com\/blog\/#\/schema\/person\/82a299a8284a66ff49f97c74684724a0\"},\"breadcrumb\":{\"@id\":\"https:\/\/virtualserversvps.com\/blog\/linux-kernel-parameters-vps-network-performance\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/virtualserversvps.com\/blog\/linux-kernel-parameters-vps-network-performance\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/virtualserversvps.com\/blog\/linux-kernel-parameters-vps-network-performance\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/virtualserversvps.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Linux Kernel Parameters to Tune for Better VPS Network Performance\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/virtualserversvps.com\/blog\/#website\",\"url\":\"https:\/\/virtualserversvps.com\/blog\/\",\"name\":\"Virtual Servers VPS Blog\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/virtualserversvps.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/virtualserversvps.com\/blog\/#\/schema\/person\/82a299a8284a66ff49f97c74684724a0\",\"name\":\"Virtual-Servers-Vps-Editor\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/virtualserversvps.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/d820b15f1cd028e97610d9adf536df7be5cb6423869967037d468d5355fa003f?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/d820b15f1cd028e97610d9adf536df7be5cb6423869967037d468d5355fa003f?s=96&d=mm&r=g\",\"caption\":\"Virtual-Servers-Vps-Editor\"},\"sameAs\":[\"https:\/\/virtualserversvps.com\/blog\"],\"url\":\"https:\/\/virtualserversvps.com\/blog\/author\/virtualserversvps\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Linux Kernel Parameters to Tune for Better VPS Network Performance - Virtual Servers VPS Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/virtualserversvps.com\/blog\/linux-kernel-parameters-vps-network-performance\/","og_locale":"en_US","og_type":"article","og_title":"Linux Kernel Parameters to Tune for Better VPS Network Performance","og_description":"Linux Kernel Parameters to Tune for Better VPS Network Performance","og_url":"https:\/\/virtualserversvps.com\/blog\/linux-kernel-parameters-vps-network-performance\/","og_site_name":"Virtual Servers VPS Blog","article_published_time":"2026-08-23T22:39:05+00:00","author":"Virtual-Servers-Vps-Editor","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Virtual-Servers-Vps-Editor","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/virtualserversvps.com\/blog\/linux-kernel-parameters-vps-network-performance\/","url":"https:\/\/virtualserversvps.com\/blog\/linux-kernel-parameters-vps-network-performance\/","name":"Linux Kernel Parameters to Tune for Better VPS Network Performance - Virtual Servers VPS Blog","isPartOf":{"@id":"https:\/\/virtualserversvps.com\/blog\/#website"},"datePublished":"2026-08-23T22:39:05+00:00","author":{"@id":"https:\/\/virtualserversvps.com\/blog\/#\/schema\/person\/82a299a8284a66ff49f97c74684724a0"},"breadcrumb":{"@id":"https:\/\/virtualserversvps.com\/blog\/linux-kernel-parameters-vps-network-performance\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/virtualserversvps.com\/blog\/linux-kernel-parameters-vps-network-performance\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/virtualserversvps.com\/blog\/linux-kernel-parameters-vps-network-performance\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/virtualserversvps.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Linux Kernel Parameters to Tune for Better VPS Network Performance"}]},{"@type":"WebSite","@id":"https:\/\/virtualserversvps.com\/blog\/#website","url":"https:\/\/virtualserversvps.com\/blog\/","name":"Virtual Servers VPS Blog","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/virtualserversvps.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/virtualserversvps.com\/blog\/#\/schema\/person\/82a299a8284a66ff49f97c74684724a0","name":"Virtual-Servers-Vps-Editor","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/virtualserversvps.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/d820b15f1cd028e97610d9adf536df7be5cb6423869967037d468d5355fa003f?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/d820b15f1cd028e97610d9adf536df7be5cb6423869967037d468d5355fa003f?s=96&d=mm&r=g","caption":"Virtual-Servers-Vps-Editor"},"sameAs":["https:\/\/virtualserversvps.com\/blog"],"url":"https:\/\/virtualserversvps.com\/blog\/author\/virtualserversvps\/"}]}},"_links":{"self":[{"href":"https:\/\/virtualserversvps.com\/blog\/wp-json\/wp\/v2\/posts\/955","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/virtualserversvps.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/virtualserversvps.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/virtualserversvps.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/virtualserversvps.com\/blog\/wp-json\/wp\/v2\/comments?post=955"}],"version-history":[{"count":2,"href":"https:\/\/virtualserversvps.com\/blog\/wp-json\/wp\/v2\/posts\/955\/revisions"}],"predecessor-version":[{"id":959,"href":"https:\/\/virtualserversvps.com\/blog\/wp-json\/wp\/v2\/posts\/955\/revisions\/959"}],"wp:attachment":[{"href":"https:\/\/virtualserversvps.com\/blog\/wp-json\/wp\/v2\/media?parent=955"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/virtualserversvps.com\/blog\/wp-json\/wp\/v2\/categories?post=955"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/virtualserversvps.com\/blog\/wp-json\/wp\/v2\/tags?post=955"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}