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:
parent
97cce402ae
commit
a5449a0d22
1 changed files with 13 additions and 5 deletions
|
@ -1923,14 +1923,14 @@ sub calculations {
|
||||||
# Max used memory is memory used by MySQL based on Max_used_connections
|
# 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
|
# This is the max memory used theorically calculated with the max concurrent connection number reached by mysql
|
||||||
$mycalc{'max_used_memory'} =
|
$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'} =
|
$mycalc{'pct_max_used_memory'} =
|
||||||
percentage( $mycalc{'max_used_memory'}, $physical_memory );
|
percentage( $mycalc{'max_used_memory'}, $physical_memory );
|
||||||
|
|
||||||
# Total possible memory is memory needed by MySQL based on max_connections
|
# 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
|
# This is the max memory MySQL can theorically used if all connections allowed has opened by mysql
|
||||||
$mycalc{'max_peak_memory'} =
|
$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'} =
|
$mycalc{'pct_max_physical_memory'} =
|
||||||
percentage( $mycalc{'max_peak_memory'}, $physical_memory );
|
percentage( $mycalc{'max_peak_memory'}, $physical_memory );
|
||||||
|
|
||||||
|
@ -2275,7 +2275,7 @@ sub mysql_stats {
|
||||||
. " global + "
|
. " global + "
|
||||||
. hr_bytes( $mycalc{'per_thread_buffers'} )
|
. hr_bytes( $mycalc{'per_thread_buffers'} )
|
||||||
. " per thread ($myvar{'max_connections'} max threads)";
|
. " per thread ($myvar{'max_connections'} max threads)";
|
||||||
|
infoprint "P_S Max memory usage: ".hr_bytes_rnd(get_pf_memory());
|
||||||
if ( $opt{buffers} ne 0 ) {
|
if ( $opt{buffers} ne 0 ) {
|
||||||
infoprint "Global Buffers";
|
infoprint "Global Buffers";
|
||||||
infoprint " +-- Key Buffer: "
|
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
|
# Recommendations for Performance Schema
|
||||||
sub mysqsl_pfs {
|
sub mysqsl_pfs {
|
||||||
prettyprint
|
prettyprint
|
||||||
|
@ -2927,6 +2934,7 @@ sub mysqsl_pfs {
|
||||||
else {
|
else {
|
||||||
infoprint "Performance schema is enabled.";
|
infoprint "Performance schema is enabled.";
|
||||||
}
|
}
|
||||||
|
infoprint "Memory used by P_S: ". hr_bytes(get_pf_memory());
|
||||||
}
|
}
|
||||||
|
|
||||||
# Recommendations for Ariadb
|
# Recommendations for Ariadb
|
||||||
|
|
Loading…
Reference in a new issue