The MySQL InnoDB buffer pool caches table and index data in memory. MySQL documentation notes that dedicated database servers can allocate a large portion of physical memory to it.
Size MySQL/MariaDB by RAM, InnoDB buffer pool, connections, NVMe IOPS/latency, redo logs, swap and workload type.
The MySQL InnoDB buffer pool caches table and index data in memory. MySQL documentation notes that dedicated database servers can allocate a large portion of physical memory to it.
MySQL 8.4 documentation suggests a typical buffer-pool range around 50-75% of system memory, while dedicated-server auto sizing uses about 75% above 4 GB. This should not be copied blindly onto mixed web+DB hosts.
On a database-only VM, much of RAM can go to InnoDB because web, PHP and mail run elsewhere. On a mixed VPS with panel, PHP-FPM, Redis and MySQL, copying the same percentage can cause OOM or swap.
Classify the workload first: OLTP random queries, analytics scans, WordPress/WooCommerce metadata-heavy queries and API transactions behave differently.
The goal is to keep the active working set in memory. Too small causes repeated disk reads; too large starves the OS and per-connection/query memory. MySQL's 50-75% guidance is a starting point, not a universal rule.
MariaDB also relies on the InnoDB buffer pool. Because versions and defaults differ, use MariaDB's own documentation and metrics rather than copying MySQL settings blindly.
mysql -e "SELECT @@version, @@innodb_buffer_pool_size;"mysql -e "SHOW GLOBAL STATUS LIKE 'Innodb_buffer_pool%';"mysql -e "SHOW ENGINE INNODB STATUS\G"MySQL memory is more than the buffer pool. Connections can allocate sort, join and read buffers; temp tables, thread caches and Performance Schema consume memory too. Setting max_connections to 1000 does not create capacity.
Measure real concurrent and idle connections when applications use pools. OOM can happen during connection spikes even if normal-hour RAM looks fine.
Buffer-pool misses, redo-log flushes, fsync, temp-table spills and checkpoints are latency-sensitive. For databases, 4K random latency and p95/p99 completion times can matter more than a large sequential bandwidth number.
NVMe branding may describe physical media but not storage backend or IOPS limits. Benchmark the actual VM with fio and database workloads.
Having swap is not inherently wrong, but continuously paging the active database working set can cause severe latency. Swap can provide safety, while sustained swap-in/out signals memory pressure.
free -hvmstat 1 20iostat -x 1 20mysqladmin processlistHigh-concurrency OLTP can benefit from more cores, while low-concurrency heavy queries may care more about per-core speed. Poor query design is not fixed by adding CPU alone.
Small WordPress DB: 2-4 vCPU, 4-8 GB RAM and low-latency NVMe. Medium WooCommerce/API DB: 4-8 vCPU, 8-32 GB. Busy dedicated DB: 8-16+ strong cores, 32-128+ GB ECC, enterprise NVMe mirror and separate backups. Final sizing depends on working set and query profile.
| Workload | CPU | RAM | Storage |
|---|---|---|---|
| WordPress/WooCommerce | Good per-core | Working set + cache | Low random latency |
| Busy OLTP | More cores | Large buffer pool | High IOPS |
| Reporting | Parallel CPU | Large RAM | Sequential + random mix |
Do not confuse minimum system requirements with production capacity. Evaluate peak workload, backups, growth headroom, resource-sharing policy and recovery planning together.
On a dedicated DB, MySQL guidance often starts around 50-75%; on a mixed host you must reserve memory for other services first.
No, but low latency and high IOPS can be a major advantage for busy workloads. Measure the actual VM storage.
Evaluate CPU, RAM, storage, network and operations together; buying a larger plan without identifying the bottleneck is rarely a durable fix.