Enable query classifier cache by default

Enabling it will give a performance improvement and it offloads work from
the CPU. This leads to better and more complete utilization of system
resources.
This commit is contained in:
Markus Mäkelä
2018-08-22 08:52:28 +03:00
parent 13c04324cf
commit 1692765503
4 changed files with 64 additions and 17 deletions

View File

@ -1123,6 +1123,22 @@ bool config_load_global(const char *filename)
{
log_config_error(filename, rval);
}
else
{
// Do some post-processing for auto-sized default variables
if (gateway.qc_cache_properties.max_size == -1)
{
int64_t mem_per_thr = get_total_memory() * 0.4 / gateway.n_threads;
mxb_assert(mem_per_thr >= 0);
gateway.qc_cache_properties.max_size = mem_per_thr;
if (mem_per_thr == 0)
{
MXS_WARNING("Could not auto-detect total system memory for the query classifier "
"cache. Manually define `%s` to enable it.", CN_QUERY_CLASSIFIER_CACHE_SIZE);
}
}
}
return rval == 0;
}
@ -2608,6 +2624,9 @@ void config_set_global_defaults()
gateway.passive = false;
gateway.promoted_at = 0;
// Note: This is not a valid cache value: it is used to detect that the default value is used
gateway.qc_cache_properties.max_size = -1;
gateway.thread_stack_size = 0;
gateway.writeq_high_water = 0;
gateway.writeq_low_water = 0;