mirror of
https://github.com/dragonflydb/dragonfly.git
synced 2025-05-11 10:25:47 +02:00
feat(server): introduce rss oom limit (#3702)
* introduce rss denyoom limit Signed-off-by: adi_holden <adi@dragonflydb.io>
This commit is contained in:
parent
5cf917871c
commit
4d38271efa
12 changed files with 209 additions and 64 deletions
|
@ -113,13 +113,14 @@ void ServerState::Destroy() {
|
|||
state_ = nullptr;
|
||||
}
|
||||
|
||||
uint64_t ServerState::GetUsedMemory(uint64_t now_ns) {
|
||||
ServerState::MemoryUsageStats ServerState::GetMemoryUsage(uint64_t now_ns) {
|
||||
static constexpr uint64_t kCacheEveryNs = 1000;
|
||||
if (now_ns > used_mem_last_update_ + kCacheEveryNs) {
|
||||
used_mem_last_update_ = now_ns;
|
||||
used_mem_cached_ = used_mem_current.load(std::memory_order_relaxed);
|
||||
memory_stats_cached_.used_mem = used_mem_current.load(std::memory_order_relaxed);
|
||||
memory_stats_cached_.rss_mem = rss_mem_current.load(std::memory_order_relaxed);
|
||||
}
|
||||
return used_mem_cached_;
|
||||
return memory_stats_cached_;
|
||||
}
|
||||
|
||||
bool ServerState::AllowInlineScheduling() const {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue