patternsqlModerate
Maximum possible memory usage: 16.2G (874% of installed RAM)
Viewed 0 times
maximumusagepossiblememory874raminstalled
Problem
Why the MySQL is saying that can use about 16GB of RAM even if my server has only about 2GB?
```
# ./mysqltuner.pl
>> MySQLTuner 1.2.0 - Major Hayden
>> Bug reports, feature requests, and downloads at http://mysqltuner.com/
>> Run with '--help' for additional options and output filtering
-------- General Statistics --------------------------------------------------
[--] Skipped version check for MySQLTuner script
[OK] Currently running supported MySQL version 5.5.34-cll
[OK] Operating on 32-bit architecture with less than 2GB RAM
-------- Storage Engine Statistics -------------------------------------------
[--] Status: +Archive -BDB -Federated +InnoDB -ISAM -NDBCluster
[--] Data in MyISAM tables: 457M (Tables: 1361)
[--] Data in MRG_MYISAM tables: 53M (Tables: 36)
[--] Data in InnoDB tables: 792M (Tables: 1133)
[--] Data in PERFORMANCE_SCHEMA tables: 0B (Tables: 17)
[--] Data in MEMORY tables: 0B (Tables: 2)
[!!] Total fragmented tables: 175
-------- Security Recommendations -------------------------------------------
[OK] All database users have passwords assigned
-------- Performance Metrics -------------------------------------------------
[--] Up for: 54s (2K q [37.537 qps], 325 conn, TX: 1M, RX: 354K)
[--] Reads / Writes: 90% / 10%
[--] Total buffers: 1.7G global + 18.6M per thread (800 max threads)
[!!] Allocating > 2GB RAM on 32-bit systems can cause system instability
[!!] Maximum possible memory usage: 16.2G (874% of installed RAM)
[OK] Slow queries: 0% (9/2K)
[OK] Highest usage of available connections: 1% (13/800)
[OK] Key buffer size / total MyISAM indexes: 128.0M/78.9M
[!!] Key buffer hit rate: 73.9% (1K cached / 297 reads)
[OK] Query cache efficiency: 42.4% (388 cached / 915 selects)
[OK] Query cache prunes per day: 0
[OK] Sorts requiring temporary tables: 0% (0 temp sorts / 148 sorts)
[OK] Temporary tables created on disk: 21% (114 on disk / 537 total)
[OK] Thread cache hit rate: 94% (17 created / 325 connections)
[OK] Table cache hit r
```
# ./mysqltuner.pl
>> MySQLTuner 1.2.0 - Major Hayden
>> Bug reports, feature requests, and downloads at http://mysqltuner.com/
>> Run with '--help' for additional options and output filtering
-------- General Statistics --------------------------------------------------
[--] Skipped version check for MySQLTuner script
[OK] Currently running supported MySQL version 5.5.34-cll
[OK] Operating on 32-bit architecture with less than 2GB RAM
-------- Storage Engine Statistics -------------------------------------------
[--] Status: +Archive -BDB -Federated +InnoDB -ISAM -NDBCluster
[--] Data in MyISAM tables: 457M (Tables: 1361)
[--] Data in MRG_MYISAM tables: 53M (Tables: 36)
[--] Data in InnoDB tables: 792M (Tables: 1133)
[--] Data in PERFORMANCE_SCHEMA tables: 0B (Tables: 17)
[--] Data in MEMORY tables: 0B (Tables: 2)
[!!] Total fragmented tables: 175
-------- Security Recommendations -------------------------------------------
[OK] All database users have passwords assigned
-------- Performance Metrics -------------------------------------------------
[--] Up for: 54s (2K q [37.537 qps], 325 conn, TX: 1M, RX: 354K)
[--] Reads / Writes: 90% / 10%
[--] Total buffers: 1.7G global + 18.6M per thread (800 max threads)
[!!] Allocating > 2GB RAM on 32-bit systems can cause system instability
[!!] Maximum possible memory usage: 16.2G (874% of installed RAM)
[OK] Slow queries: 0% (9/2K)
[OK] Highest usage of available connections: 1% (13/800)
[OK] Key buffer size / total MyISAM indexes: 128.0M/78.9M
[!!] Key buffer hit rate: 73.9% (1K cached / 297 reads)
[OK] Query cache efficiency: 42.4% (388 cached / 915 selects)
[OK] Query cache prunes per day: 0
[OK] Sorts requiring temporary tables: 0% (0 temp sorts / 148 sorts)
[OK] Temporary tables created on disk: 21% (114 on disk / 537 total)
[OK] Thread cache hit rate: 94% (17 created / 325 connections)
[OK] Table cache hit r
Solution
Staring at the mysqltuner output, I see something disturbing
What is 800 * 18M ?
That's 14G your DB Server cannot handle.
RECOMMENDATION
Add this to
then restart mysql and run mysqltuner.pl again. You will see lower numbers.
Give it a Try !!!
[--] Total buffers: 1.7G global + 18.6M per thread (800 max threads)- The 800 is the max_connections.
- The 18M is a sum that includes read_buffer_size + sort_buffer_size + join_buffer_size
What is 800 * 18M ?
mysql> select 18 * 1024 * 1024 * 800 / power(1024,3);
+----------------------------------------+
| 18 * 1024 * 1024 * 800 / power(1024,3) |
+----------------------------------------+
| 14.0625 |
+----------------------------------------+
1 row in set (0.00 sec)That's 14G your DB Server cannot handle.
RECOMMENDATION
Add this to
my.cnf[mysqld]
sort_buffer_size = 1M
join_buffer_size = 1M
read_buffer_size = 1M
max_connections = 100then restart mysql and run mysqltuner.pl again. You will see lower numbers.
Give it a Try !!!
Code Snippets
[--] Total buffers: 1.7G global + 18.6M per thread (800 max threads)mysql> select 18 * 1024 * 1024 * 800 / power(1024,3);
+----------------------------------------+
| 18 * 1024 * 1024 * 800 / power(1024,3) |
+----------------------------------------+
| 14.0625 |
+----------------------------------------+
1 row in set (0.00 sec)[mysqld]
sort_buffer_size = 1M
join_buffer_size = 1M
read_buffer_size = 1M
max_connections = 100Context
StackExchange Database Administrators Q#55525, answer score: 13
Revisions (0)
No revisions yet.