The innodb_buffer_pool_size controls how much RAM MySQL uses to cache InnoDB tables and indexes. On a cPanel host, this is usually the single most impactful MySQL setting — sized right, queries hit RAM and run in microseconds; sized wrong, queries hit disk and run in milliseconds. The cPanel default is conservative (128 MB), the typical advice (“use 70-80% of RAM”) is wrong on a shared host, and the right answer requires knowing how much data is hot vs cold.
What’s happening
InnoDB stores tables and indexes in 16 KB pages. When a query needs a page, MySQL first checks the buffer pool (in RAM). If the page is there, the read is a memory lookup. If not, MySQL reads from disk into the buffer pool — slow, especially on busy disks. The buffer pool is shared across all databases and all users on the MySQL instance.
On a dedicated database server, the “70-80% of RAM” guidance is reasonable. On a shared cPanel host, MySQL competes with PHP-FPM workers, Apache/LiteSpeed, exim, ClamAV, and others. Allocating 80% of RAM to MySQL on a host that also runs PHP-FPM with 400 workers eating 50 MB each will cause swap.
The sizing question is really: how much of the total database working set is hot? If all 50 customers’ databases sum to 8 GB but only 2 GB is actively queried, a 2 GB buffer pool is enough.
How to verify
Current settings and hit rate:
mysql -e "SHOW VARIABLES LIKE 'innodb_buffer_pool_size'"
mysql -e "SHOW STATUS LIKE 'Innodb_buffer_pool%'"
Compute the buffer pool hit rate:
mysql -e "SHOW STATUS LIKE 'Innodb_buffer_pool_reads'; SHOW STATUS LIKE 'Innodb_buffer_pool_read_requests'"
Hit rate = 1 - (reads / read_requests). Above 99% is excellent; below 95% means the buffer pool is too small for the working set.
Total InnoDB data size on the host:
mysql -e "SELECT table_schema, ROUND(SUM(data_length + index_length)/1024/1024, 2) AS MB FROM information_schema.tables WHERE engine = 'InnoDB' GROUP BY table_schema ORDER BY MB DESC LIMIT 20"
The fix
The sizing approach:
-
Inventory the working set. Sum the InnoDB data sizes across all databases. The total is the maximum useful buffer pool size; going bigger wastes RAM.
-
Cap by host budget. On a 32 GB cPanel host running PHP-FPM, web, mail, and OS, MySQL should get 30-40% of RAM — 10-12 GB. On a 16 GB host, 4-6 GB. On 64 GB+, the 70% rule applies again because the non-MySQL workloads do not scale linearly.
-
Set in
/etc/my.cnf:[mysqld] innodb_buffer_pool_size = 8G innodb_buffer_pool_instances = 8 innodb_log_file_size = 512M innodb_flush_log_at_trx_commit = 2 innodb_flush_method = O_DIRECTinnodb_buffer_pool_instancesshould be 1 per GB of pool size (with a cap of 8). -
Restart MySQL during a maintenance window (changes to buffer pool size require restart on older MySQL; MySQL 5.7+ supports online resize, but restart is cleaner).
-
Re-check hit rate after a week of real load. If it is below 95%, the pool is undersized; raise. If it is above 99.9%, the pool is oversized; lower to free RAM for other workloads.
The trap to avoid: sizing the pool for “all data fits in RAM” when in practice most data is rarely queried. A 100 GB database can run great with an 8 GB buffer pool if the active queries hit a 6 GB working set. Stack Harbor sizes MySQL per workload as part of cPanel server management.