Log query classifier cache size on startup
This commit is contained in:
parent
5a87748153
commit
6045c90bf0
@ -1224,6 +1224,29 @@ bool config_load_global(const char* filename)
|
||||
"cache. Manually define `%s` to enable it.",
|
||||
CN_QUERY_CLASSIFIER_CACHE_SIZE);
|
||||
}
|
||||
else
|
||||
{
|
||||
std::vector<const char*> suffixes
|
||||
{
|
||||
"B",
|
||||
"KiB",
|
||||
"MiB",
|
||||
"GiB",
|
||||
"TiB",
|
||||
"PiB",
|
||||
"EiB",
|
||||
"ZiB",
|
||||
"YiB"
|
||||
};
|
||||
// Get the total used cache memory
|
||||
int64_t total_mem = mem_per_thr * gateway.n_threads;
|
||||
// Calculate log1024(total_mem) and round it up
|
||||
double c = ceil(log(total_mem) / log(1024));
|
||||
// In case someone still uses MaxScale in the year 3054
|
||||
int idx = std::min(c, (double)(suffixes.size())) - 1;
|
||||
double num = total_mem / pow(1024, idx);
|
||||
MXS_NOTICE("Using up to %.2lf%s of memory for query classifier cache", num, suffixes[idx]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user