I have an AWS ElastiCache instance hosted on a cache.m5.xlarge
instance type, which advertises 12.93gb
of ram.
from the AWS ElastiCache documentation it says that a cache.m5.xlarge
instance should have its maxmemory
set to 13891921715
, which divided by 1024*1024*1024 equals roughly 12.94gb
.
However, we recently found out that our server is evicting keys based upon the maxmemory-policy: volatile-lru
configuration when hitting roughly 9.7gb
.
Upon inspecting the actual maching using redis-cli
and issuing a info memory
command, we get:
my-stack.ng.0001.use1.cache.amazonaws.com:6379> info memory
# Memory
used_memory:10070155984
used_memory_human:9.38G
used_memory_rss:10629488640
used_memory_rss_human:9.90G
used_memory_peak:10419154184
used_memory_peak_human:9.70G
used_memory_peak_perc:96.65%
used_memory_overhead:581297150
used_memory_startup:3668736
used_memory_dataset:9488858834
used_memory_dataset_perc:94.26%
allocator_allocated:10073929632
allocator_active:10463571968
allocator_resident:10660438016
used_memory_lua:60416
used_memory_lua_human:59.00K
used_memory_scripts:1032
used_memory_scripts_human:1.01K
number_of_cached_scripts:4
maxmemory:10418941287
maxmemory_human:9.70G
maxmemory_policy:volatile-lru
allocator_frag_ratio:1.04
allocator_frag_bytes:389642336
allocator_rss_ratio:1.02
allocator_rss_bytes:196866048
rss_overhead_ratio:1.00
rss_overhead_bytes:-30949376
mem_fragmentation_ratio:1.06
mem_fragmentation_bytes:559163408
mem_not_counted_for_evict:0
mem_replication_backlog:1048576
mem_clients_slaves:49806
mem_clients_normal:6528840
mem_aof_buffer:0
mem_allocator:jemalloc-5.1.0
active_defrag_running:0
lazyfree_pending_objects:0
The biggest point I see here is maxmemory:10418941287
, which is about 3.2gb
less than expected.
Our server configuration is setup with replication, so in total we have two cache.m5.xlarge
nodes.
Why is there the dependency between the actual server's maxmemory
setting and what the documentation is saying, and is there any way to use more of the server's memory for actual cached items?