chore: measure rss memory and track its peak (#2054)

Up until know we did not have cached rss metric in the process.
This PR consolidates caching of all values together inside the EngineShard periodic fiber
code. Also, we know expose rss_mem_current that can be used internally for identifying
memory pressuring periods during the process run.

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
This commit is contained in:
Roman Gershman 2023-10-22 22:01:40 +03:00 committed by GitHub
parent d9cb7453fb
commit 15f54be762
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 45 additions and 31 deletions

View file

@ -175,6 +175,9 @@ const char* RdbTypeName(unsigned type);
// Cached values, updated frequently to represent the correct state of the system.
extern std::atomic_uint64_t used_mem_peak;
extern std::atomic_uint64_t used_mem_current;
extern std::atomic_uint64_t rss_mem_current;
extern std::atomic_uint64_t rss_mem_peak;
extern size_t max_memory_limit;
// malloc memory stats.