New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: auto config cache size according to memory size #3165
Conversation
0f2b8f4
to
3d35d69
Compare
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #3165 +/- ##
==========================================
- Coverage 85.63% 85.31% -0.32%
==========================================
Files 829 829
Lines 135773 136163 +390
==========================================
- Hits 116273 116172 -101
- Misses 19500 19991 +491 |
@zhongzc I add the check about cgroup, if you have time, PTAL. |
Co-authored-by: Yingwen <realevenyag@gmail.com> Co-authored-by: Dennis Zhuang <killme2008@gmail.com>
|
||
/// Get the total memory of the system. | ||
/// If `cgroup_limits` is enabled, it will also check it. | ||
pub fn get_sys_total_memory() -> Option<ReadableSize> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have an idea:
Can we obtain a logical memory size here, which should be smaller than the system memory.
Consider the following scenario:
The user deploys our DB on a machine with a large amount of memory, and this machine is also running other processes.
They want our DB to occupy less memory. It would be better if we can provide a parameter to specify the memory size, for example, by specifying it through startup parameters.
Then in the get_sys_total_memory
method, we return the minimum value between it and sys_total_memory
: Min(logical_total_memory, sys_total_memory)
.
The same idea for the get_cpus()
I hereby agree to the terms of the GreptimeDB CLA
What's changed and what's your intention?
cpu_nums
crate and usesysinfo
.For example, my computer has 16G memory and 8 cpu cores
The possible concern here is
sysinfo
couldn't get system info in some unpopular OS.update 2024.1.17
docker container(ubuntu 24.04), host memory=28G, cpus=16, we limit cpus = 8, memory = 8G, test again.
the result:
Checklist
Refer to a related PR or issue link (optional)