{"id":1776,"date":"2026-11-18T22:57:03","date_gmt":"2026-11-18T22:57:03","guid":{"rendered":"https:\/\/virtualserversvps.com\/blog\/?p=1776"},"modified":"2026-11-18T22:57:03","modified_gmt":"2026-11-18T22:57:03","slug":"kvm-vps-memory-bandwidth-contention-stream","status":"publish","type":"post","link":"https:\/\/virtualserversvps.com\/blog\/kvm-vps-memory-bandwidth-contention-stream\/","title":{"rendered":"Measuring Memory Bandwidth Contention Between KVM Guests with STREAM on a VPS"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Two KVM guests on the same host share more than a scheduler: they share the memory controller, the L3 cache slices and the interconnect. When a noisy neighbour starts streaming through a large array, your guest&#8217;s effective memory bandwidth can fall by a third even though <code>\/proc\/meminfo<\/code> shows plenty of free RAM and CPU steal stays near zero. The only reliable way to see this on a VPS is to measure achieved bandwidth from inside the guest, repeatedly, and watch the distribution rather than a single number.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The tool for this is STREAM, and the setup takes five minutes on any recent distribution. If you are evaluating a provider before committing, run this alongside the checks in <a href=\"https:\/\/virtualserversvps.com\/\">our VPS performance guides<\/a>; bandwidth variance is one of the few signals that reliably distinguishes a quiet host from a busy one.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Build a fixed-width STREAM binary<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">STREAM&#8217;s numbers depend entirely on array size. If the arrays fit in L3, you measure cache, not DRAM. Set the array size to roughly ten times the last-level cache so the working set cannot be resident, and compile with the same flags every time so runs are comparable.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>lscpu | grep -i 'L3 cache'\ngit clone https:\/\/github.com\/jeffhammond\/STREAM.git &amp;&amp; cd STREAM\ngcc -O3 -march=native -fopenmp -DSTREAM_ARRAY_SIZE=200000000 \\\n    -DNTIMES=20 stream.c -o stream_omp\nOMP_NUM_THREADS=$(nproc) .\/stream_omp | egrep 'Copy|Scale|Add|Triad'<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">At 200 million doubles the total footprint is about 4.8 GB across three arrays, which is comfortably above any consumer L3 and large enough that page placement across NUMA nodes averages out. On a 2 GB plan, drop to <code>100000000<\/code>; on anything smaller, use <code>50000000<\/code> and note it in your results, because the smaller footprint inflates the cache fraction.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Run it as a time series, not a single shot<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">A single STREAM run tells you what the host looked like for eight seconds. Loop it for half an hour, keep only the Triad figure, and compute the spread. A quiet host gives a coefficient of variation under 2%; a contended one gives 10\u201325% with visible dips.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>for i in $(seq 1 30); do\n  OMP_NUM_THREADS=$(nproc) .\/stream_omp \\\n    | awk -v t=$(date +%s) '\/Triad:\/ {printf \"%s %.1f\\n\", t, $2}'\ndone | tee \/tmp\/triad.tsv\nawk '{s+=$2; ss+=$2*$2; n++} END {\n  m=s\/n; v=ss\/n-m*m; printf \"mean=%.1f sd=%.1f cv=%.1f%%\\n\", m, sqrt(v), 100*sqrt(v)\/m\n}' \/tmp\/triad.tsv<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Triad \u2014 <code>a[i] = b[i] + c[i]*d[i]<\/code> \u2014 is the right metric because it exercises two read streams and one write stream simultaneously, which is what most application workloads do. Copy measures pure read\/write and tends to be optimistic on hosts with a large write-combining buffer.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Read the pages-per-second counter as corroboration<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">STREAM gives you MB\/s; the kernel gives you an independent view. <code>perf stat<\/code> can count uncore or core memory events depending on what the hypervisor exposes, but on most VPS plans the vPMU is masked. The portable fallback is to watch fault and reclaim behaviour during the run and confirm the working set is genuinely hitting DRAM.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>perf stat -e cycles,instructions,cache-misses -a sleep 10 2&gt;&amp;1 | tail -5\nsar -B 1 30 | awk '{print $1, $5, $6}'   # pgpgin, pgpgout\ncat \/sys\/kernel\/debug\/x86\/amd_df_indirect_lcl 2&gt;\/dev\/null || echo \"vPMU masked by hypervisor\"<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">If <code>perf stat<\/code> returns &#8220;not supported&#8221; for cache events, that is itself a finding: the provider has masked the vPMU, so branch-miss and cache-miss profiling inside the guest is impossible. Record it, and fall back to STREAM plus <code>sar<\/code> paging counters for your memory-bandwidth picture.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Single-thread versus saturated bandwidth matter differently<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Most applications never saturate the memory bus, but many are limited by per-core bandwidth. Run STREAM a second time with <code>OMP_NUM_THREADS=1<\/code> and compare against the full-thread result. A healthy host scales close to linearly up to the number of physical cores; a contended one shows poor scaling because threads queue on the same memory controller path that a neighbour is already flooding.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>for t in 1 2 4 $(nproc); do\n  printf \"threads=%s \" \"$t\"\n  OMP_NUM_THREADS=$t .\/stream_omp | awk '\/Triad:\/ {print $2\" MB\/s\"}'\ndone<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Record both numbers in your capacity notes. The single-thread figure is what a PHP-FPM worker or a single-threaded database connection will see, while the saturated figure predicts batch job throughput. If single-thread Triad drops below about 60% of the host&#8217;s spec-sheet figure while multi-thread stays flat, the bottleneck is contention rather than configuration and no kernel tweak will fix it.<\/p>\n\n\n<h2 class=\"wp-block-heading\">Detect the contention pattern across the day<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Memory contention from neighbours is cyclic because workloads are cyclic. A nightly backup job on the host, a batch analytics window, or another tenant&#8217;s CI runner will show up as a repeatable trough at the same hour. Run the Triad loop every 15 minutes for 48 hours with a cron entry and plot the mean per hour.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>*\/15 * * * * cd \/root\/STREAM &amp;&amp; OMP_NUM_THREADS=2 .\/stream_omp \\\n  | awk -v t=$(date +\\%s) '\/Triad:\/ {print t, $2}' &gt;&gt; \/var\/log\/triad.log<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">A flat hourly profile at 90% of the host&#8217;s theoretical bandwidth means the plan is well isolated. A 30% dip every evening means a predictable neighbour, and if your own workload peaks in that same window you have found a real, provable reason for latency that CPU metrics will never explain.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Check whether huge pages change the answer<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Transparent huge pages reduce TLB pressure and can lift STREAM numbers by 5\u201315%, but on a guest the hypervisor decides whether large pages are actually backed by large physical frames. Compare the two modes before drawing conclusions, and remember that a host giving you THP without backing is effectively faking the win.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>cat \/sys\/kernel\/mm\/transparent_hugepage\/enabled\ngrep -i AnonHugePages \/proc\/meminfo\necho defer &gt; \/sys\/kernel\/mm\/transparent_hugepage\/enabled   # or madvise\/always\nOMP_NUM_THREADS=$(nproc) .\/stream_omp | grep Triad:<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">If the Triad figure barely moves between <code>never<\/code> and <code>always<\/code>, the guest is not getting large frames and the setting is noise. Document the mode you settled on so later runs stay comparable.<\/p>\n\n\n<h2 class=\"wp-block-heading\">Turn the numbers into a purchase or migration decision<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">For reference, a dedicated modern server with dual-channel DDR4-3200 delivers roughly 20\u201325 GB\/s of Triad bandwidth per socket with near-zero variance. A shared VPS on a busy host often delivers 6\u201312 GB\/s with a 15% coefficient of variation. Both numbers can be entirely adequate for a web application; neither will satisfy a memory-bound in-memory cache that expects consistent latency.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Measure first, then decide whether you need a bigger plan or a quieter host. A higher tier on a busy machine can still lose to a smaller tier on a quiet one, and only the time-series tells you which case you are in \u2014 so keep the <code>triad.tsv<\/code> history and re-run it whenever response times shift without a matching change in traffic.<\/p>\n\n","protected":false},"excerpt":{"rendered":"<p>Two KVM guests on the same host share more than a scheduler: they share the memory controller, the L3 cache slices and the interconnect. When a noisy neighbour starts streaming&#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":1,"footnotes":""},"categories":[3],"tags":[],"class_list":["post-1776","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>Measuring Memory Bandwidth Contention Between KVM Guests with STREAM on a VPS - Virtual Servers VPS Blog<\/title>\n<meta name=\"description\" content=\"Two KVM guests on the same host share more than a scheduler: they share the memory controller, the L3 cache slices and the interconnect. When a noisy\" \/>\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\/kvm-vps-memory-bandwidth-contention-stream\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Measuring Memory Bandwidth Contention Between KVM Guests with STREAM on a VPS\" \/>\n<meta property=\"og:description\" content=\"Measuring Memory Bandwidth Contention Between KVM Guests with STREAM on a VPS\" \/>\n<meta property=\"og:url\" content=\"https:\/\/virtualserversvps.com\/blog\/kvm-vps-memory-bandwidth-contention-stream\/\" \/>\n<meta property=\"og:site_name\" content=\"Virtual Servers VPS Blog\" \/>\n<meta property=\"article:published_time\" content=\"2026-11-18T22:57:03+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\/kvm-vps-memory-bandwidth-contention-stream\/\",\"url\":\"https:\/\/virtualserversvps.com\/blog\/kvm-vps-memory-bandwidth-contention-stream\/\",\"name\":\"Measuring Memory Bandwidth Contention Between KVM Guests with STREAM on a VPS - Virtual Servers VPS Blog\",\"isPartOf\":{\"@id\":\"https:\/\/virtualserversvps.com\/blog\/#website\"},\"datePublished\":\"2026-11-18T22:57:03+00:00\",\"author\":{\"@id\":\"https:\/\/virtualserversvps.com\/blog\/#\/schema\/person\/82a299a8284a66ff49f97c74684724a0\"},\"description\":\"Two KVM guests on the same host share more than a scheduler: they share the memory controller, the L3 cache slices and the interconnect. When a noisy\",\"breadcrumb\":{\"@id\":\"https:\/\/virtualserversvps.com\/blog\/kvm-vps-memory-bandwidth-contention-stream\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/virtualserversvps.com\/blog\/kvm-vps-memory-bandwidth-contention-stream\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/virtualserversvps.com\/blog\/kvm-vps-memory-bandwidth-contention-stream\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/virtualserversvps.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Measuring Memory Bandwidth Contention Between KVM Guests with STREAM on a VPS\"}]},{\"@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":"Measuring Memory Bandwidth Contention Between KVM Guests with STREAM on a VPS - Virtual Servers VPS Blog","description":"Two KVM guests on the same host share more than a scheduler: they share the memory controller, the L3 cache slices and the interconnect. When a noisy","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\/kvm-vps-memory-bandwidth-contention-stream\/","og_locale":"en_US","og_type":"article","og_title":"Measuring Memory Bandwidth Contention Between KVM Guests with STREAM on a VPS","og_description":"Measuring Memory Bandwidth Contention Between KVM Guests with STREAM on a VPS","og_url":"https:\/\/virtualserversvps.com\/blog\/kvm-vps-memory-bandwidth-contention-stream\/","og_site_name":"Virtual Servers VPS Blog","article_published_time":"2026-11-18T22:57:03+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\/kvm-vps-memory-bandwidth-contention-stream\/","url":"https:\/\/virtualserversvps.com\/blog\/kvm-vps-memory-bandwidth-contention-stream\/","name":"Measuring Memory Bandwidth Contention Between KVM Guests with STREAM on a VPS - Virtual Servers VPS Blog","isPartOf":{"@id":"https:\/\/virtualserversvps.com\/blog\/#website"},"datePublished":"2026-11-18T22:57:03+00:00","author":{"@id":"https:\/\/virtualserversvps.com\/blog\/#\/schema\/person\/82a299a8284a66ff49f97c74684724a0"},"description":"Two KVM guests on the same host share more than a scheduler: they share the memory controller, the L3 cache slices and the interconnect. When a noisy","breadcrumb":{"@id":"https:\/\/virtualserversvps.com\/blog\/kvm-vps-memory-bandwidth-contention-stream\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/virtualserversvps.com\/blog\/kvm-vps-memory-bandwidth-contention-stream\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/virtualserversvps.com\/blog\/kvm-vps-memory-bandwidth-contention-stream\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/virtualserversvps.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Measuring Memory Bandwidth Contention Between KVM Guests with STREAM on a VPS"}]},{"@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\/1776","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=1776"}],"version-history":[{"count":2,"href":"https:\/\/virtualserversvps.com\/blog\/wp-json\/wp\/v2\/posts\/1776\/revisions"}],"predecessor-version":[{"id":1781,"href":"https:\/\/virtualserversvps.com\/blog\/wp-json\/wp\/v2\/posts\/1776\/revisions\/1781"}],"wp:attachment":[{"href":"https:\/\/virtualserversvps.com\/blog\/wp-json\/wp\/v2\/media?parent=1776"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/virtualserversvps.com\/blog\/wp-json\/wp\/v2\/categories?post=1776"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/virtualserversvps.com\/blog\/wp-json\/wp\/v2\/tags?post=1776"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}