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 # 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
@ -3758,7 +3766,7 @@ cve_recommendations; # Display related CVE
calculations; # Calculate everything we need calculations; # Calculate everything we need
mysql_stats; # Print the server stats mysql_stats; # Print the server stats
mysqsl_pfs # Print Performance schema info mysqsl_pfs # Print Performance schema info
mariadb_threadpool; # Print MaraiDB ThreadPool stats mariadb_threadpool; # Print MaraiDB ThreadPool stats
mysql_myisam; # Print MyISAM stats mysql_myisam; # Print MyISAM stats
mariadb_ariadb; # Print MaraiDB AriaDB stats mariadb_ariadb; # Print MaraiDB AriaDB stats
mysql_innodb; # Print InnoDB stats mysql_innodb; # Print InnoDB stats