Databases 6 min read

Memory Consumption Comparison of MySQL 8.0 vs MySQL 5.7 on Small Cloud Instances

The article compares MySQL 8.0 and MySQL 5.7 memory usage on a 1 GB VM, showing that MySQL 8.0 consumes significantly more resident and swap memory despite similar lightweight workloads, and provides the test configuration and observations for developers.

Aikesheng Open Source Community
Aikesheng Open Source Community
Aikesheng Open Source Community
Memory Consumption Comparison of MySQL 8.0 vs MySQL 5.7 on Small Cloud Instances

Although MySQL is often run on large‑scale systems, it is also deployed on minimal cloud instances or local laptops, where memory consumption becomes critical.

When comparing MySQL 8.0 with MySQL 5.7, the newer version uses noticeably more memory even under the same lightweight workload on a 1 GB virtual machine.

MySQL 5.7 vmstat output:

procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu----- r b swpd free buff cache si so bi bo in cs us sy id wa st 4 0 65280 71608 58352 245108 0 0 2582 3611 1798 8918 18 9 11 33 30 4 0 65280 68288 58500 247512 0 0 2094 2662 1769 8508 19 9 13 30 29 3 1 65280 67780 58636 249656 0 0 2562 3924 1883 9323 20 9 7 37 27 4 1 65280 66196 58720 251072 0 0 1936 3949 1587 7731 15 7 11 36 31

MySQL 8.0 vmstat output:

procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu----- r b swpd free buff cache si so bi bo in cs us sy id wa st 9 1 275356 62280 60832 204736 0 0 2197 5245 2638 13453 24 13 2 34 27 3 0 275356 60548 60996 206340 0 0 1031 3449 2446 12895 25 11 10 28 26 7 1 275356 78188 59564 190632 0 1 2448 5082 2677 13661 26 13 6 30 25 4 1 275356 76516 59708 192096 0 0 2247 3750 2401 12210 22 12 4 38 24

The results show MySQL 8.0 using roughly 200 MB of swap space and allocating more memory overall while using less system cache.

Top‑command screenshots (images) also illustrate that MySQL 8.0 has higher resident (RSS) and virtual (VSZ) memory, with the virtual memory far exceeding the 1 GB physical limit of the VM.

Even though neither version swaps under low load, using swap may become necessary when multiple connections or additional applications share the same VM, otherwise an out‑of‑memory (OOM) condition could occur.

Test configuration (my.cnf):

[mysqld] innodb_buffer_pool_size=256M innodb_buffer_pool_instances=1 innodb_log_file_size=1G innodb_flush_method=O_DIRECT innodb_numa_interleave=1 innodb_flush_neighbors=0 log_bin server_id=1 expire_logs_days=1 log_output=file slow_query_log=ON long_query_time=0 log_slow_rate_limit=1 log_slow_rate_type=query log_slow_verbosity=full log_slow_admin_statements=ON log_slow_slave_statements=ON slow_query_log_always_write_time=1 slow_query_log_use_global_control=all innodb_monitor_enable=all userstat=1

Conclusion: When migrating development environments to MySQL 8.0, be aware that the same configuration consumes more memory than MySQL 5.7, so plan resources accordingly.

PerformanceDatabaseConfigurationMySQLMemory usagevmstat
Aikesheng Open Source Community
Written by

Aikesheng Open Source Community

The Aikesheng Open Source Community provides stable, enterprise‑grade MySQL open‑source tools and services, releases a premium open‑source component each year (1024), and continuously operates and maintains them.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.