Merge pull request #765 from jmrenouard/master

New CLI-Option "nondedicated" for non-dedicated servers #748
This commit is contained in:
Jean-Marie Renouard 2024-02-09 00:44:28 +01:00 committed by GitHub
commit f0848b8489
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 36 additions and 9 deletions

View file

@ -44,15 +44,20 @@ You must provide the remote server's total memory when connecting to other serve
--template <path> Path to a template file --template <path> Path to a template file
--dumpdir <path> Path to a directory where to dump information files --dumpdir <path> Path to a directory where to dump information files
--feature <feature> Run a specific feature (see FEATURES section) --feature <feature> Run a specific feature (see FEATURES section)
=head1 OUTPUT OPTIONS --dumpdir <path> information_schema tables and sys views are dumped in CSV in this path
# OUTPUT OPTIONS
--silent Don't output anything on screen --silent Don't output anything on screen
--verbose Print out all options (default: no verbose, dbstat, idxstat, sysstat, tbstat, pfstat) --verbose Print out all options (default: no verbose, dbstat, idxstat, sysstat, tbstat, pfstat)
--color Print output in color
--nocolor Don't print output in color --nocolor Don't print output in color
--nogood Remove OK responses --nogood Remove OK responses
--nobad Remove negative/suggestion responses --nobad Remove negative/suggestion responses
--noinfo Remove informational responses --noinfo Remove informational responses
--debug Print debug information --debug Print debug information
--experimental Print experimental analysis (may failed)
--nondedicated Consider server is not dedicated to Db server usage only
--noprocess Consider no other process is running --noprocess Consider no other process is running
--dbstat Print database information --dbstat Print database information
--nodbstat Don't print database information --nodbstat Don't print database information

View file

@ -110,6 +110,7 @@ my %opt = (
"reportfile" => 0, "reportfile" => 0,
"verbose" => 0, "verbose" => 0,
"experimental" => 0, "experimental" => 0,
"nondedicated" => 0,
"defaults-file" => '', "defaults-file" => '',
"defaults-extra-file" => '', "defaults-extra-file" => '',
"protocol" => '', "protocol" => '',
@ -152,7 +153,8 @@ GetOptions(
'server-log=s', 'protocol=s', 'server-log=s', 'protocol=s',
'defaults-extra-file=s', 'dumpdir=s', 'defaults-extra-file=s', 'dumpdir=s',
'feature=s', 'dbgpattern=s', 'feature=s', 'dbgpattern=s',
'defaultarch=i', 'experimental' 'defaultarch=i', 'experimental',
'nondedicated'
) )
or pod2usage( or pod2usage(
-exitval => 1, -exitval => 1,
@ -593,6 +595,7 @@ sub os_setup {
chomp($physical_memory); chomp($physical_memory);
chomp($swap_memory); chomp($swap_memory);
chomp($os); chomp($os);
$physical_memory=$opt{forcemem} if (defined($opt{forcemem}) and $opt{forcemem} gt 0);
$result{'OS'}{'OS Type'} = $os; $result{'OS'}{'OS Type'} = $os;
$result{'OS'}{'Physical Memory'}{'bytes'} = $physical_memory; $result{'OS'}{'Physical Memory'}{'bytes'} = $physical_memory;
$result{'OS'}{'Physical Memory'}{'pretty'} = hr_bytes($physical_memory); $result{'OS'}{'Physical Memory'}{'pretty'} = hr_bytes($physical_memory);
@ -2052,6 +2055,15 @@ sub system_recommendations {
infoprint "User process except mysqld used " infoprint "User process except mysqld used "
. hr_bytes_rnd($omem) . " RAM."; . hr_bytes_rnd($omem) . " RAM.";
if ( ( 0.15 * $physical_memory ) < $omem ) { if ( ( 0.15 * $physical_memory ) < $omem ) {
if ( $opt{nondedicated}) {
infoprint "No warning with --nondedicated option";
infoprint
"Other user process except mysqld used more than 15% of total physical memory "
. percentage( $omem, $physical_memory ) . "% ("
. hr_bytes_rnd($omem) . " / "
. hr_bytes_rnd($physical_memory) . ")";
} else {
badprint badprint
"Other user process except mysqld used more than 15% of total physical memory " "Other user process except mysqld used more than 15% of total physical memory "
. percentage( $omem, $physical_memory ) . "% (" . percentage( $omem, $physical_memory ) . "% ("
@ -2063,6 +2075,7 @@ sub system_recommendations {
push( @adjvars, push( @adjvars,
"DON'T APPLY SETTINGS BECAUSE THERE ARE TOO MANY PROCESSES RUNNING ON THIS SERVER. OOM KILL CAN OCCUR!" "DON'T APPLY SETTINGS BECAUSE THERE ARE TOO MANY PROCESSES RUNNING ON THIS SERVER. OOM KILL CAN OCCUR!"
); );
}
} }
else { else {
infoprint infoprint
@ -3366,17 +3379,22 @@ sub mysql_stats {
. " ($mycalc{'pct_max_physical_memory'}% of installed RAM)"; . " ($mycalc{'pct_max_physical_memory'}% of installed RAM)";
} }
if ( $physical_memory < if ( $physical_memory <
( $mycalc{'max_peak_memory'} + get_other_process_memory() ) ) ( $mycalc{'max_peak_memory'} + get_other_process_memory() ) )
{ {
if ( $opt{nondedicated}) {
infoprint "No warning with --nondedicated option";
infoprint "Overall possible memory usage with other process exceeded memory";
} else {
badprint badprint
"Overall possible memory usage with other process exceeded memory"; "Overall possible memory usage with other process exceeded memory";
push( @generalrec, push( @generalrec,
"Dedicate this server to your database for highest performance." ); "Dedicate this server to your database for highest performance." );
} }
else { } else {
goodprint goodprint
"Overall possible memory usage with other process is compatible with memory available"; "Overall possible memory usage with other process is compatible with memory available";
} }
# Slow queries # Slow queries
@ -7458,6 +7476,8 @@ You must provide the remote server's total memory when connecting to other serve
--template <path> Path to a template file --template <path> Path to a template file
--dumpdir <path> Path to a directory where to dump information files --dumpdir <path> Path to a directory where to dump information files
--feature <feature> Run a specific feature (see FEATURES section) --feature <feature> Run a specific feature (see FEATURES section)
--dumpdir <path> information_schema tables and sys views are dumped in CSV in this path
=head1 OUTPUT OPTIONS =head1 OUTPUT OPTIONS
--silent Don't output anything on screen --silent Don't output anything on screen
@ -7468,6 +7488,8 @@ You must provide the remote server's total memory when connecting to other serve
--nobad Remove negative/suggestion responses --nobad Remove negative/suggestion responses
--noinfo Remove informational responses --noinfo Remove informational responses
--debug Print debug information --debug Print debug information
--experimental Print experimental analysis (may failed)
--nondedicated Consider server is not dedicated to Db server usage only
--noprocess Consider no other process is running --noprocess Consider no other process is running
--dbstat Print database information --dbstat Print database information
--nodbstat Don't print database information --nodbstat Don't print database information