mirror of
https://github.com/fluencelabs/redis
synced 2025-04-14 21:26:04 +00:00
Add maxmemory limit to INFO MEMORY
Since we have the eviction policy, we should have the memory limit too.
This commit is contained in:
parent
6741bb981c
commit
5a685f35a9
14
src/redis.c
14
src/redis.c
@ -2702,6 +2702,7 @@ sds genRedisInfoString(char *section) {
|
|||||||
char total_system_hmem[64];
|
char total_system_hmem[64];
|
||||||
char used_memory_lua_hmem[64];
|
char used_memory_lua_hmem[64];
|
||||||
char used_memory_rss_hmem[64];
|
char used_memory_rss_hmem[64];
|
||||||
|
char maxmemory_hmem[64];
|
||||||
size_t zmalloc_used = zmalloc_used_memory();
|
size_t zmalloc_used = zmalloc_used_memory();
|
||||||
size_t total_system_mem = server.system_memory_size;
|
size_t total_system_mem = server.system_memory_size;
|
||||||
char *evict_policy = maxmemoryToString();
|
char *evict_policy = maxmemoryToString();
|
||||||
@ -2719,6 +2720,7 @@ sds genRedisInfoString(char *section) {
|
|||||||
bytesToHuman(total_system_hmem,total_system_mem);
|
bytesToHuman(total_system_hmem,total_system_mem);
|
||||||
bytesToHuman(used_memory_lua_hmem,memory_lua);
|
bytesToHuman(used_memory_lua_hmem,memory_lua);
|
||||||
bytesToHuman(used_memory_rss_hmem,server.resident_set_size);
|
bytesToHuman(used_memory_rss_hmem,server.resident_set_size);
|
||||||
|
bytesToHuman(maxmemory_hmem,server.maxmemory);
|
||||||
|
|
||||||
if (sections++) info = sdscat(info,"\r\n");
|
if (sections++) info = sdscat(info,"\r\n");
|
||||||
info = sdscatprintf(info,
|
info = sdscatprintf(info,
|
||||||
@ -2733,9 +2735,11 @@ sds genRedisInfoString(char *section) {
|
|||||||
"total_system_memory_human:%s\r\n"
|
"total_system_memory_human:%s\r\n"
|
||||||
"used_memory_lua:%lld\r\n"
|
"used_memory_lua:%lld\r\n"
|
||||||
"used_memory_lua_human:%s\r\n"
|
"used_memory_lua_human:%s\r\n"
|
||||||
|
"maxmemory:%lld\r\n"
|
||||||
|
"maxmemory_human:%s\r\n"
|
||||||
|
"maxmemory_policy:%s\r\n"
|
||||||
"mem_fragmentation_ratio:%.2f\r\n"
|
"mem_fragmentation_ratio:%.2f\r\n"
|
||||||
"mem_allocator:%s\r\n"
|
"mem_allocator:%s\r\n",
|
||||||
"maxmemory_policy:%s\r\n",
|
|
||||||
zmalloc_used,
|
zmalloc_used,
|
||||||
hmem,
|
hmem,
|
||||||
server.resident_set_size,
|
server.resident_set_size,
|
||||||
@ -2746,9 +2750,11 @@ sds genRedisInfoString(char *section) {
|
|||||||
total_system_hmem,
|
total_system_hmem,
|
||||||
memory_lua,
|
memory_lua,
|
||||||
used_memory_lua_hmem,
|
used_memory_lua_hmem,
|
||||||
|
server.maxmemory,
|
||||||
|
maxmemory_hmem,
|
||||||
|
evict_policy,
|
||||||
zmalloc_get_fragmentation_ratio(server.resident_set_size),
|
zmalloc_get_fragmentation_ratio(server.resident_set_size),
|
||||||
ZMALLOC_LIB,
|
ZMALLOC_LIB
|
||||||
evict_policy
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user