Adding performance_schema.memoty value to max_used_memory and max_peak_memory calculation

There is always MySQL 5.7+ and adaptaive memory usage to handle porperly
This commit is contained in:
Jean-Marie RENOUARDjmrenouard@gmail.com 2016-04-05 11:40:38 -04:00
parent 97cce402ae
commit a5449a0d22

View file

@ -1923,14 +1923,14 @@ sub calculations {
# Max used memory is memory used by MySQL based on Max_used_connections
# This is the max memory used theorically calculated with the max concurrent connection number reached by mysql
$mycalc{'max_used_memory'} =
$mycalc{'server_buffers'} + $mycalc{"max_total_per_thread_buffers"};
$mycalc{'server_buffers'} + $mycalc{"max_total_per_thread_buffers"} +get_pf_memory();
$mycalc{'pct_max_used_memory'} =
percentage( $mycalc{'max_used_memory'}, $physical_memory );
# Total possible memory is memory needed by MySQL based on max_connections
# This is the max memory MySQL can theorically used if all connections allowed has opened by mysql
$mycalc{'max_peak_memory'} =
$mycalc{'server_buffers'} + $mycalc{'total_per_thread_buffers'};
$mycalc{'server_buffers'} + $mycalc{'total_per_thread_buffers'} + get_pf_memory();
$mycalc{'pct_max_physical_memory'} =
percentage( $mycalc{'max_peak_memory'}, $physical_memory );
@ -2275,7 +2275,7 @@ sub mysql_stats {
. " global + "
. hr_bytes( $mycalc{'per_thread_buffers'} )
. " per thread ($myvar{'max_connections'} max threads)";
infoprint "P_S Max memory usage: ".hr_bytes_rnd(get_pf_memory());
if ( $opt{buffers} ne 0 ) {
infoprint "Global Buffers";
infoprint " +-- Key Buffer: "
@ -2913,6 +2913,13 @@ sub mariadb_threadpool {
}
}
sub get_pf_memory
{
my @infoPFSMemory=grep /performance_schema.memory/, select_array("SHOW ENGINE PERFORMANCE_SCHEMA STATUS");
$infoPFSMemory[0] =~ s/.*\s+(\d+)$/$1/g;
return $infoPFSMemory[0];
}
# Recommendations for Performance Schema
sub mysqsl_pfs {
prettyprint
@ -2927,6 +2934,7 @@ sub mysqsl_pfs {
else {
infoprint "Performance schema is enabled.";
}
infoprint "Memory used by P_S: ". hr_bytes(get_pf_memory());
}
# Recommendations for Ariadb