feat(server): add oom guard (#1650)

1. add flag maxmemory_ratio
2. When current used memory * maxmemory_ratio > maxmemory_limit denyoom
   commands will return oom error.

Signed-off-by: adi_holden <adi@dragonflydb.io>
This commit is contained in:
adiholden 2023-08-08 23:26:35 +03:00 committed by GitHub
parent 7c99d2d111
commit 116934b008
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 51 additions and 4 deletions

View file

@ -167,6 +167,7 @@ void BaseFamilyTest::ResetService() {
Service::InitOpts opts;
opts.disable_time_update = true;
service_->Init(nullptr, {}, opts);
used_mem_current = 0;
TEST_current_time_ms = absl::GetCurrentTimeNanos() / 1000000;
auto cb = [&](EngineShard* s) { s->db_slice().UpdateExpireBase(TEST_current_time_ms - 1000, 0); };