Skip to content
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

How to control the memory usage #303

Open
DataDreamer01 opened this issue May 9, 2023 · 1 comment
Open

How to control the memory usage #303

DataDreamer01 opened this issue May 9, 2023 · 1 comment
Labels
question Further information is requested

Comments

@DataDreamer01
Copy link

From the design of Raft Engine, all keys and corresponding file locations will be cached in memory, so what happens if there are too many keys or insufficient memory to cache all keys?

@tabokie
Copy link
Member

tabokie commented May 10, 2023

Raft Engine is designed to hold a moderate amount of Raft logs (around 10GB). The index size for 10GB data set is quite small (around 100MB), so it shouldn't be a problem in most cases.

Certainly it is still possible that index grows too large. We have a memory-limit configuration for that. When the used memory exceeds the config, Raft Engine will start swapping out in-memory data to disk. Unfortunately the swapping will cause a severe drop in performance. It should only be a last resort when user application fails to control log size.

/// Maximum memory bytes allowed for the in-memory index.
/// Effective under the `swap` feature only.
///
/// Default: None
pub memory_limit: Option<ReadableSize>,

@tabokie tabokie changed the title How to console the memory usage How to control the memory usage May 10, 2023
@tabokie tabokie added the question Further information is requested label Jul 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants