<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Roy Hoàng</title>
    <description>The latest articles on DEV Community by Roy Hoàng (@roy_huang_deploy).</description>
    <link>https://dev.to/roy_huang_deploy</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4268155%2F554e5353-3275-4902-ba84-a05772fb72ee.jpg</url>
      <title>DEV Community: Roy Hoàng</title>
      <link>https://dev.to/roy_huang_deploy</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/roy_huang_deploy"/>
    <language>en</language>
    <item>
      <title>Pre-Migration RAM, OOM &amp; I/O Wait Audit on Production Linux</title>
      <dc:creator>Roy Hoàng</dc:creator>
      <pubDate>Fri, 27 Nov 2026 05:49:24 +0000</pubDate>
      <link>https://dev.to/roy_huang_deploy/pre-migration-ram-oom-io-wait-audit-on-production-linux-57a0</link>
      <guid>https://dev.to/roy_huang_deploy/pre-migration-ram-oom-io-wait-audit-on-production-linux-57a0</guid>
      <description>&lt;p&gt;Most cloud bills bloat because teams size instances by gut feeling instead of real memory math. A startup paying $165 monthly on AWS t3.xlarge ran four Docker stacks that needed 9.4GB RAM at peak.&lt;/p&gt;

&lt;p&gt;During Monday cron spikes, Linux OOM killer sent SIGKILL to Postgres because swap was zero and Node workers lacked max-old-space-size caps. Adding random vCPUs never fixed their memory ceiling.&lt;/p&gt;

&lt;p&gt;Moving that stack via reproducible cloud-init onto a 16GB Hostinger KVM 4 NVMe node at $10.49 monthly left 35% safety headroom, zero CPU steal, and eliminated midnight container restarts.&lt;/p&gt;

&lt;h2&gt;
  
  
  Pre-Migration RAM, OOM &amp;amp; I/O Wait Audit on Production Linux
&lt;/h2&gt;

&lt;p&gt;Before resizing Linux hosts or changing container memory limits, run this baseline diagnostic check to inspect actual kernel pressure and RSS footprints:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;free -h &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; swapon --show
dmesg -T &lt;span class="o"&gt;|&lt;/span&gt; grep -iE &lt;span class="s1"&gt;'out of memory|killed process'&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; tail -n 5
docker stats --no-stream --format &lt;span class="s1"&gt;'table {{.Name}}\t{{.MemUsage}}\t{{.CPUPerc}}'&lt;/span&gt;
vmstat 1 5
sysctl vm.swappiness vm.overcommit_memory
cloud-init status --long
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Check dmesg before blaming application code: a single OOM event proves peak resident memory crossed physical RAM plus swap, meaning your container cgroup limits and host tier are mismatched.&lt;/p&gt;

&lt;p&gt;Pair docker stats with vmstat column wa to separate memory pressure from NVMe storage bottlenecks. If wa stays above 10, upgrade to dedicated AMD EPYC NVMe or Vultr High Frequency compute.&lt;/p&gt;

&lt;h2&gt;
  
  
  Deterministic Memory &amp;amp; CPU Allocation Formula
&lt;/h2&gt;

&lt;p&gt;Rather than guessing instance tiers from idle container stats, budget kernel overhead, database buffers, active worker concurrency, and a 25% burst margin:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;RAM = (Peak Containers x 1.3) + 1.5GB OS Reserve
01. Size 18 Web, Docker, AI &amp;amp; Game workloads
02. Compare real KVM NVMe vs hourly cloud tiers
03. Export 1-click Ubuntu 24.04 cloud-init YAML
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Reference configuration (&lt;code&gt;deploycalc-audit.sh&lt;/code&gt;):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;#!/usr/bin/env bash&lt;/span&gt;
&lt;span class="c"&gt;# DeployCalc Production Node Sizing &amp;amp; OOM Audit — https://deploycalc.pages.dev/&lt;/span&gt;
&lt;span class="nb"&gt;set&lt;/span&gt; -euo pipefail
&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"=== Memory &amp;amp; Swap Envelope ==="&lt;/span&gt;
free -m &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; swapon --show
&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"=== Recent Kernel OOM Events ==="&lt;/span&gt;
dmesg -T 2&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;/dev/null &lt;span class="o"&gt;|&lt;/span&gt; grep -iE &lt;span class="s1"&gt;'out of memory|killed process'&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; tail -n 5 &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"=== Live Docker Container RSS ==="&lt;/span&gt;
&lt;span class="nb"&gt;command&lt;/span&gt; -v docker &lt;span class="o"&gt;&amp;gt;&lt;/span&gt;/dev/null &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; docker stats --no-stream --format &lt;span class="s1"&gt;'{{.Name}}: {{.MemUsage}}'&lt;/span&gt;
&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"=== Sysctl Swap &amp;amp; Overcommit ==="&lt;/span&gt;
sysctl vm.swappiness vm.overcommit_memory
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Operational Gotchas in Production
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Never allocate 100% of host RAM to containers: reserve 1.5GB for the Linux kernel, systemd journald, OverlayFS metadata, and emergency SSH sessions during heavy traffic spikes.&lt;/li&gt;
&lt;li&gt;Burstable cloud instances throttle CPU credits silently once baseline utilization crosses 20% to 30%, turning fast staging builds into 4-second API timeouts in production.&lt;/li&gt;
&lt;li&gt;Skipping a 2GB to 4GB NVMe swapfile with vm.swappiness=10 removes your shock absorber, forcing the kernel OOM killer to terminate database processes on transient memory bursts.&lt;/li&gt;
&lt;li&gt;Hand-configuring servers over SSH creates snowflake drift; declarative cloud-init YAML provisions UFW rules, unattended upgrades, Docker daemon log rotation, and swap in 90 seconds.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Vertical Headroom vs Premature Cluster Complexity
&lt;/h2&gt;

&lt;p&gt;Teams obsess over Kubernetes auto-scaling long before breaking 5,000 requests per minute, paying $140 monthly in control-plane overhead and NAT gateways before serving a single customer.&lt;/p&gt;

&lt;p&gt;In production sizing, one vertically right-sized 16GB or 32GB KVM NVMe instance with 30% headroom outperforms a chatty multi-node cluster by avoiding cross-node network serialization.&lt;/p&gt;

&lt;h2&gt;
  
  
  Pre-Cutover Verification Checklist
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;[ ] Export exact peak RSS memory per service using docker stats and add 30% headroom plus 1.5GB OS reserve to pick your KVM tier.&lt;/li&gt;
&lt;li&gt;[ ] Generate a cloud-init YAML config hardening SSH keys, UFW ports 22/80/443, 4GB swap, and Docker JSON log rotation capped at 50MB.&lt;/li&gt;
&lt;li&gt;[ ] Lower DNS TTL to 60 seconds a day ahead, sync PostgreSQL or volumes over WireGuard, and verify checksums before switching live traffic.&lt;/li&gt;
&lt;li&gt;[ ] Keep the old instance read-only for 48 hours while monitoring vmstat steal and iowait metrics under real weekday peak concurrency.&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;em&gt;If you want to test different concurrency inputs or generate a ready-to-run configuration for this workload, you can use the interactive sizing sandbox I built at &lt;a href="https://deploycalc.pages.dev/en/" rel="noopener noreferrer"&gt;deploycalc.pages.dev/en/&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>selfhosted</category>
      <category>devops</category>
      <category>docker</category>
      <category>cloud</category>
    </item>
  </channel>
</rss>
