{"id":1202,"date":"2026-09-22T23:13:20","date_gmt":"2026-09-22T23:13:20","guid":{"rendered":"https:\/\/virtualserversvps.com\/blog\/?p=1202"},"modified":"2026-09-22T23:13:20","modified_gmt":"2026-09-22T23:13:20","slug":"tuning-net-ipv4-tcp-rmem-high-latency-vps","status":"publish","type":"post","link":"https:\/\/virtualserversvps.com\/blog\/tuning-net-ipv4-tcp-rmem-high-latency-vps\/","title":{"rendered":"Tuning net.ipv4.tcp_rmem for High-Latency VPS Workloads: Buffer Sizing by Bandwidth-Delay Product"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Default receive-buffer autotuning on Linux fails in one specific situation: a high bandwidth-delay product. On a VPS talking to clients 150&ndash;250 ms away, the default <code>net.ipv4.tcp_rmem<\/code> maximum of 6 MB caps the receive window and, with it, single-stream throughput. This article measures the ceiling, shows how to read the relevant counters, and gives buffer values that match real latency instead of the localhost assumptions the defaults were built for.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Read the current values before changing anything<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>sysctl net.ipv4.tcp_rmem net.ipv4.tcp_wmem net.ipv4.tcp_moderate_rcvbuf\nsysctl net.core.rmem_max net.core.wmem_max\n# actual per-socket buffers in use, live\nss -timm | grep -A1 'ESTAB' | head -20\nnstat -az TcpExtTCPRcvChecksumError 2&gt;\/dev\/null; nstat -az | grep -i win<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><code>tcp_rmem<\/code> has three fields: minimum, default, and maximum. Autotuning (controlled by <code>tcp_moderate_rcvbuf<\/code>) moves a socket between minimum and maximum based on measured throughput, but it cannot exceed <strong>the maximum<\/strong>, and it cannot exceed <code>net.core.rmem_max<\/code> for explicit <code>SO_RCVBUF<\/code> requests either. The buffer that matters is whichever of the two is smaller.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">The bandwidth-delay product sets the floor<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">To keep a pipe full, the receive window must hold one round-trip&#8217;s worth of data. The arithmetic is <code>BDP = bandwidth &times; RTT<\/code>. At 1 Gbit\/s and 200 ms RTT: 1,000,000,000 bits\/s &times; 0.2 s = 200,000,000 bits = 25 MB. A 6 MB maximum receive buffer is less than a quarter of that, so a single TCP stream can never fill the link no matter how fast the server is.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>RTT to client<\/th><th>BDP at 100 Mbit\/s<\/th><th>BDP at 1 Gbit\/s<\/th><th>BDP at 10 Gbit\/s<\/th><th>Default 6 MB window covers<\/th><\/tr><\/thead><tbody><tr><td>10 ms (same region)<\/td><td>0.125 MB<\/td><td>1.25 MB<\/td><td>12.5 MB<\/td><td>All except 10G<\/td><\/tr><tr><td>50 ms (cross-country)<\/td><td>0.6 MB<\/td><td>6.25 MB<\/td><td>62.5 MB<\/td><td>Up to ~1 Gbit\/s<\/td><\/tr><tr><td>120 ms (transatlantic)<\/td><td>1.5 MB<\/td><td>15 MB<\/td><td>150 MB<\/td><td>Only ~400 Mbit\/s<\/td><\/tr><tr><td>200 ms (transpacific)<\/td><td>2.5 MB<\/td><td>25 MB<\/td><td>250 MB<\/td><td>Only ~240 Mbit\/s<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">The last column is the practical finding: with default buffers, a transpacific 1 Gbit\/s uplink tops out near 240 Mbit\/s per stream. Multi-stream transfers (browsers, rsync with parallel streams, HTTP\/2) mask this because each stream gets its own window, which is why a speed test can look fine while a single <code>scp<\/code> crawls. If you are choosing an instance partly on the strength of its network tier, this per-stream ceiling is worth factoring into <a href=\"https:\/\/virtualserversvps.com\/\">the VPS platform comparison<\/a> rather than trusting a headline port speed.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Tuning values and the memory bill<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code># \/etc\/sysctl.d\/99-tcp-buffers.conf\nnet.core.rmem_max = 33554432          # 32 MB hard ceiling\nnet.core.wmem_max = 33554432\nnet.ipv4.tcp_rmem = 4096 1048576 33554432   # min  default  max\nnet.ipv4.tcp_wmem = 4096 1048576 33554432\nnet.ipv4.tcp_moderate_rcvbuf = 1     # keep autotuning on\nnet.ipv4.tcp_window_scaling = 1       # required above 64 KB windows\nnet.ipv4.tcp_slow_start_after_idle = 0\nnet.core.optmem_max = 65536<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Two points about cost. First, buffers are allocated on demand, not at socket creation, so the maxima are ceilings rather than reservations &mdash; the kernel grows a socket&#8217;s buffer only as autotuning sees fit. Second, the cost is real under load: 500 concurrent connections each claiming a 32 MB window can account for gigabytes, which is why the maximum belongs sized to your RAM, not to the largest number you have seen someone else use. On a 1 GB instance, 8&ndash;16 MB maxima are a reasonable compromise; on 4 GB or more, 32 MB is comfortable. How much RAM an instance actually offers, and how much of it the provider reserves for the host, matters here &mdash; see <a href=\"https:\/\/virtualserversvps.com\/\">how VPS memory allocation works in practice<\/a> before sizing maxima against a headline figure.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Verify with a real transfer, not a speed test<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Apply with <code>sysctl --system<\/code>, then measure a single stream to a distant host and watch the window grow:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># run the transfer, then sample the window on the live socket\nss -timm dst 203.0.113.10 | grep -E 'rcv_space|rcv_wnd|wscale|rtt'\n# server-side counter check\ncat \/proc\/net\/snmp | grep -A1 '^Tcp:'\n# sanity: confirm the kernel accepted the new maximum\nsysctl net.ipv4.tcp_rmem net.core.rmem_max<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">In <code>ss -timm<\/code> output, <code>rcv_space<\/code> is the buffer the kernel has grown for that socket and <code>rtt<\/code> is the measured round trip &mdash; multiply the two by the throughput and you can confirm the window matches the BDP. If <code>rcv_space<\/code> stops at the old maximum, either the sysctl did not apply or the socket was opened before the change; new connections pick up new sysctls, existing ones do not. If <code>rcv_space<\/code> grows to 32 MB but throughput is unchanged, the bottleneck is not the receive window and you are chasing the wrong layer &mdash; check for retransmits with <code>ss -ti<\/code> (look at <code>retrans<\/code>) before tuning buffers further.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Receive and send buffers are not symmetric<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Most guides tune <code>tcp_rmem<\/code> and stop. That is correct for a server whose dominant traffic is outbound &mdash; a file host, a game server, a video origin serving uploads &mdash; because the receive window is the constraint on how fast the sender may push. For a server whose dominant traffic is inbound transfers (backups pulled down, packages fetched, a scraper), the equivalent limit is <code>tcp_wmem<\/code>, and the same bandwidth-delay arithmetic applies. Tune both when you do not know which direction dominates, and check the average socket direction in <code>ss -s<\/code> or <code>nstat -az | grep -i segs_out<\/code> versus <code>segs_in<\/code> to find out.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Interaction with congestion control<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Buffer sizing and congestion control are separate levers that are often conflated. BBR (congestion control) estimates bandwidth and RTT and is not loss-sensitive, so it can reach high throughput on lossy long-haul links where loss-based CUBIC stalls. A large receive window and a BBR sender together are what actually produce near-BDP throughput. Enabling BBR without widening the buffers leaves the window as the ceiling; widening the buffers without BBR leaves loss sensitivity in place. Confirm what is active before concluding buffers are the problem:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sysctl net.ipv4.tcp_congestion_control\nsysctl net.ipv4.tcp_available_congestion_control\n# enable BBR only after confirming the module is available\nmodprobe tcp_bbr &amp;&amp; sysctl -w net.ipv4.tcp_congestion_control=bbr\n# persistence\necho 'net.ipv4.tcp_congestion_control=bbr' &gt;&gt; \/etc\/sysctl.d\/99-tcp-buffers.conf<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Test the change with a real transfer to a remote host, not a localhost benchmark. A loopback transfer never traverses the network stack&#8217;s window limits in the same way and will report line-rate no matter how small the buffers are. Measure against a host at realistic RTT, and record the before\/after <code>rcv_space<\/code> value for the same flow so the comparison is anchored to a number rather than a feeling.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The default 6 MB TCP receive-buffer ceiling caps single-stream throughput on high-RTT links. Measure the bandwidth-delay product, size tcp_rmem and core.rmem_max correctly, and verify with live socket statistics.<\/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":[3],"tags":[],"class_list":["post-1202","post","type-post","status-publish","format-standard","hentry","category-performance-optimization"],"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>Tuning net.ipv4.tcp_rmem for High-Latency VPS Workloads: Buffer Sizing by Bandwidth-Delay Product - 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\/tuning-net-ipv4-tcp-rmem-high-latency-vps\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Tuning net.ipv4.tcp_rmem for High-Latency VPS Workloads: Buffer Sizing by Bandwidth-Delay Product\" \/>\n<meta property=\"og:description\" content=\"Tuning net.ipv4.tcp_rmem for High-Latency VPS Workloads: Buffer Sizing by Bandwidth-Delay Product\" \/>\n<meta property=\"og:url\" content=\"https:\/\/virtualserversvps.com\/blog\/tuning-net-ipv4-tcp-rmem-high-latency-vps\/\" \/>\n<meta property=\"og:site_name\" content=\"Virtual Servers VPS Blog\" \/>\n<meta property=\"article:published_time\" content=\"2026-09-22T23:13:20+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=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/virtualserversvps.com\/blog\/tuning-net-ipv4-tcp-rmem-high-latency-vps\/\",\"url\":\"https:\/\/virtualserversvps.com\/blog\/tuning-net-ipv4-tcp-rmem-high-latency-vps\/\",\"name\":\"Tuning net.ipv4.tcp_rmem for High-Latency VPS Workloads: Buffer Sizing by Bandwidth-Delay Product - Virtual Servers VPS Blog\",\"isPartOf\":{\"@id\":\"https:\/\/virtualserversvps.com\/blog\/#website\"},\"datePublished\":\"2026-09-22T23:13:20+00:00\",\"author\":{\"@id\":\"https:\/\/virtualserversvps.com\/blog\/#\/schema\/person\/82a299a8284a66ff49f97c74684724a0\"},\"breadcrumb\":{\"@id\":\"https:\/\/virtualserversvps.com\/blog\/tuning-net-ipv4-tcp-rmem-high-latency-vps\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/virtualserversvps.com\/blog\/tuning-net-ipv4-tcp-rmem-high-latency-vps\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/virtualserversvps.com\/blog\/tuning-net-ipv4-tcp-rmem-high-latency-vps\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/virtualserversvps.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Tuning net.ipv4.tcp_rmem for High-Latency VPS Workloads: Buffer Sizing by Bandwidth-Delay Product\"}]},{\"@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":"Tuning net.ipv4.tcp_rmem for High-Latency VPS Workloads: Buffer Sizing by Bandwidth-Delay Product - 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\/tuning-net-ipv4-tcp-rmem-high-latency-vps\/","og_locale":"en_US","og_type":"article","og_title":"Tuning net.ipv4.tcp_rmem for High-Latency VPS Workloads: Buffer Sizing by Bandwidth-Delay Product","og_description":"Tuning net.ipv4.tcp_rmem for High-Latency VPS Workloads: Buffer Sizing by Bandwidth-Delay Product","og_url":"https:\/\/virtualserversvps.com\/blog\/tuning-net-ipv4-tcp-rmem-high-latency-vps\/","og_site_name":"Virtual Servers VPS Blog","article_published_time":"2026-09-22T23:13:20+00:00","author":"Virtual-Servers-Vps-Editor","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Virtual-Servers-Vps-Editor","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/virtualserversvps.com\/blog\/tuning-net-ipv4-tcp-rmem-high-latency-vps\/","url":"https:\/\/virtualserversvps.com\/blog\/tuning-net-ipv4-tcp-rmem-high-latency-vps\/","name":"Tuning net.ipv4.tcp_rmem for High-Latency VPS Workloads: Buffer Sizing by Bandwidth-Delay Product - Virtual Servers VPS Blog","isPartOf":{"@id":"https:\/\/virtualserversvps.com\/blog\/#website"},"datePublished":"2026-09-22T23:13:20+00:00","author":{"@id":"https:\/\/virtualserversvps.com\/blog\/#\/schema\/person\/82a299a8284a66ff49f97c74684724a0"},"breadcrumb":{"@id":"https:\/\/virtualserversvps.com\/blog\/tuning-net-ipv4-tcp-rmem-high-latency-vps\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/virtualserversvps.com\/blog\/tuning-net-ipv4-tcp-rmem-high-latency-vps\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/virtualserversvps.com\/blog\/tuning-net-ipv4-tcp-rmem-high-latency-vps\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/virtualserversvps.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Tuning net.ipv4.tcp_rmem for High-Latency VPS Workloads: Buffer Sizing by Bandwidth-Delay Product"}]},{"@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\/1202","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=1202"}],"version-history":[{"count":1,"href":"https:\/\/virtualserversvps.com\/blog\/wp-json\/wp\/v2\/posts\/1202\/revisions"}],"predecessor-version":[{"id":1204,"href":"https:\/\/virtualserversvps.com\/blog\/wp-json\/wp\/v2\/posts\/1202\/revisions\/1204"}],"wp:attachment":[{"href":"https:\/\/virtualserversvps.com\/blog\/wp-json\/wp\/v2\/media?parent=1202"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/virtualserversvps.com\/blog\/wp-json\/wp\/v2\/categories?post=1202"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/virtualserversvps.com\/blog\/wp-json\/wp\/v2\/tags?post=1202"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}