InnoDB Buffer Pool Sizing: A Practical Rule of Thumb for Small VPS
InnoDB buffer pool sizing is the single most useful MySQL setting on a small VPS. The buffer pool is the memory cache where InnoDB keeps table data and indexes, so most reads never touch the disk. Set it too small and every query hits slow storage. Set it too large and the operating system starts swapping, which hurts more than a small cache ever would. This guide covers a simple rule of thumb, how to apply it on a 1GB or 2GB server, and how to check whether the value you picked is working.
What the InnoDB Buffer Pool Actually Does
When MySQL reads a row, it loads the whole 16KB page that holds that row into the buffer pool. The next read of the same page comes from memory instead of disk. Writes work the same way: InnoDB changes the page in memory first, then writes it to disk later in the background. A pool that holds your working set, the pages your queries touch again and again, keeps response times steady even on a cheap VPS with slow disks.
The pool also caches index pages and internal structures such as the change buffer. That is why it matters more than any other single MySQL setting for read-heavy workloads like WordPress, where the same posts, options, and postmeta rows get served on every page load.
InnoDB Buffer Pool Sizing: The Rule of Thumb
The commonly quoted rule of thumb is to give the buffer pool 50 to 70 percent of total RAM on a dedicated database server, where MySQL is the only service running. When people ask about mysql buffer pool size, this percentage range is the answer they usually get. That range works because the operating system still needs memory for its own page cache, connections, and background work. On a shared VPS that also runs Nginx, PHP-FPM, and maybe Redis, the share has to come down.
A practical starting point for a small VPS looks like this. On a 1GB server, start with 256MB to 384MB for the pool. On a 2GB server, 512MB to 1GB is a reasonable range. On a 4GB server, 1GB to 2GB leaves room for the web stack. These are starting points, not final answers. The right value depends on how large your database is and how much memory the rest of the stack needs, so measure after you set it.
One more point: the pool only helps up to the size of your data. If your whole database is 200MB, a 1GB pool wastes memory that PHP or the operating system could use. Size the pool against the database, not against the RAM alone.
How Much RAM to Give MySQL on a 1GB or 2GB VPS
Before you pick a number, add up what else runs on the box. Nginx needs little, but PHP-FPM workers can each take 30 to 50MB, and a handful of workers adds up fast. The buffer pool gets what is left after the web layer and a safety margin.
| VPS RAM | Database only | Web + database on one box |
|---|---|---|
| 1GB | 512MB | 256MB to 384MB |
| 2GB | 1GB to 1.25GB | 512MB to 1GB |
| 4GB | 2GB to 2.5GB | 1GB to 2GB |
Leave at least 512MB free for the operating system and other services on a 2GB box, and more if the box runs anything else. A server that runs out of memory kills processes, and the process it kills is often MySQL itself.
Setting innodb_buffer_pool_size in my.cnf
The setting lives in the MySQL configuration file, usually /etc/mysql/my.cnf or a file under /etc/mysql/mysql.conf.d/ on Ubuntu and Debian. Add or change the line under the [mysqld] section:
[mysqld]
innodb_buffer_pool_size = 512M
Use a plain value with a suffix, such as 256M or 1G. MySQL accepts the value in bytes too, but the suffix form is easier to read and harder to get wrong. After editing, restart MySQL with sudo systemctl restart mysql and confirm the value took effect:
mysql -e "SHOW VARIABLES LIKE 'innodb_buffer_pool_size';"
On MySQL 8.0 and MariaDB 10.2.2 or newer, you can also resize the pool while the server runs with SET GLOBAL innodb_buffer_pool_size = 536870912;. That is handy for testing, but write the value in the config file too, or the next reboot silently reverts your tuning. For a full set of low-memory values that work well next to this one, see our MySQL 8.4 tuning guide for a 2GB VPS.
innodb_buffer_pool_instances: When to Split the Pool
The innodb buffer pool instances setting (innodb_buffer_pool_instances) splits the pool into separate regions, each with its own lock. On a busy server with many concurrent threads, that split reduces lock contention, because threads working on different pages do not wait on the same lock. On a quiet small VPS, it changes very little.
MySQL 8.0 defaults to 8 instances when the pool is 1GB or larger, and 1 instance below that. A simple guide is one instance per 1GB of pool, up to 8: a 512MB pool stays at 1, a 2GB pool can use 2, and a 4GB pool can use 4. Setting 8 instances on a 256MB pool only adds overhead, since each region ends up too small to hold a working set. If you run MariaDB on a tight box, our MariaDB 11 tuning guide for a low-memory VPS covers the same settings with values matched to 1 to 2GB of RAM.
How to Check Your InnoDB Buffer Pool Hit Rate
After the server has run under normal traffic for a day or two, check the hit rate: a hit means a requested page was already in memory. SHOW ENGINE INNODB STATUS prints a line like Buffer pool hit rate 998 / 1000, meaning 998 of the last 1000 page reads came from memory. Anything above 990 out of 1000 is healthy, and below 950 suggests the pool is too small for the working set.
For a number you can track over time, use the status counters instead:
SHOW GLOBAL STATUS LIKE 'Innodb_buffer_pool_read%';
Divide Innodb_buffer_pool_read_requests by the sum of that value plus Innodb_buffer_pool_reads to get the hit ratio. A value of 0.99 or higher is good for most small sites. Check again after a traffic spike or after adding a plugin with heavy queries, because a pool that was fine last month can fall behind as the database grows. Pair this check with our WordPress database optimization guide when the numbers start to slip.
Signs You Sized It Wrong
A pool that is too small shows up as disk reads that never settle. Queries that used to be fast get slower as the database grows, iostat shows constant read activity, and the hit rate sits below 950 out of 1000. Raise the pool in steps of 128MB or 256MB, then watch the hit rate and free memory for a day before raising it again.
A pool that is too large shows up differently. The server swaps, pages load slowly even though the hit rate looks fine, and the out-of-memory killer may end MySQL without warning. Any steady swap use, visible with free -h, is a warning sign. If you see it, lower the pool and check whether swap was even configured sensibly, using our guide to swap on a VPS, when to enable it and how much to allocate.
What Not to Do on a Small VPS
Do not set the pool to 80 percent of RAM on a box that also runs a web server. That leaves nothing for PHP workers, and the first traffic spike pushes the server into swap or kills a process. Do not copy a value from a guide written for a dedicated 64GB database server, where MySQL owns the whole box.
Do not change five settings at once. If performance improves, you will not know which change did it, and if it gets worse, you will not know which one to revert. Change the pool size, measure for a day, then move on to the next setting. Do not skip the restart check either: a typo in my.cnf stops MySQL from starting, so run sudo systemctl status mysql right after the restart.
If the database keeps growing past what a 1GB or 2GB VPS can cache, the fix is more RAM or a separate database server, not a cleverer pool setting. Check how much memory your WordPress install actually needs in our guide to how much RAM a WordPress VPS needs, then decide whether the next step is a bigger plan or a split stack. A pool sized with a clear rule, checked against the hit rate, and revisited as the data grows will carry a small VPS a long way.