mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 03:52:35 +01:00
MDEV-33488 Windows 11 misdetects mariadbd as LowQoS process, throttles CPU.
The effect is reduced performance, at least on hybrid processor systems. To fix, turn off throttling power explicitly at server startup.
This commit is contained in:
parent
53c6c823dc
commit
27b064d882
1 changed files with 20 additions and 0 deletions
|
@ -219,6 +219,25 @@ static const char *get_svc_name(const char *arg)
|
|||
return arg ? arg : "MySQL";
|
||||
}
|
||||
|
||||
/*
|
||||
Disable CPU throttling for the process.
|
||||
|
||||
Windows 11 heuristics misdetects server as a background process and runs it
|
||||
on "efficiency" cores, in hybrid architectures such as Alder Lake (12th
|
||||
generation Intel Core).This results in serious performance degradation.
|
||||
*/
|
||||
void disable_cpu_throttling()
|
||||
{
|
||||
#ifdef PROCESS_POWER_THROTTLING_EXECUTION_SPEED
|
||||
PROCESS_POWER_THROTTLING_STATE power_throttling{};
|
||||
power_throttling.Version= PROCESS_POWER_THROTTLING_CURRENT_VERSION;
|
||||
power_throttling.ControlMask= PROCESS_POWER_THROTTLING_EXECUTION_SPEED;
|
||||
power_throttling.StateMask= 0;
|
||||
SetProcessInformation(GetCurrentProcess(), ProcessPowerThrottling,
|
||||
&power_throttling, sizeof(power_throttling));
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
Main function on Windows.
|
||||
Runs mysqld as normal process, or as a service.
|
||||
|
@ -230,6 +249,7 @@ __declspec(dllexport) int mysqld_win_main(int argc, char **argv)
|
|||
save_argv= argv;
|
||||
save_argc= argc;
|
||||
|
||||
disable_cpu_throttling();
|
||||
/*
|
||||
If no special arguments are given, service name is nor present
|
||||
run as normal program.
|
||||
|
|
Loading…
Reference in a new issue