<b>More swap won't save a 1GB box. Lower swappiness will.</b>
Everyone adds a 4GB swapfile and calls it done. On a 1GB VPS that just means your MySQL gets paged to disk and the site crawls. The real knob:
— <code>sysctl vm.swappiness=10</code> (default is 60, way too eager)
— <code>sysctl vm.vfs_cache_pressure=50</code>
Make it stick in <code>/etc/sysctl.d/99-swap.conf</code>. Now the kernel keeps your hot pages in RAM and only swaps as a real last resort. Same $5 box, page loads went from 1.8s to 400ms under load. Try it tonight.
Root Access Daily
@RootAccessDaily
<b>More swap won't save a 1GB box. Lower swappiness will.</b>
Этот пост опубликован в Telegram-канале Root Access Daily. Подписаться можно по ссылке: @RootAccessDaily.