GitHub user rizkymma added a comment to the discussion: How to limit RAM usage

Hi, I have a similar question. How can I limit the RAM usage without impacting 
the write buffer? I have the following configurations:

[kvrocks.conf.txt](https://github.com/user-attachments/files/19206743/kvrocks.conf.txt)

TLDR:

```
root@rmas1:~# grep block_cache_size kvrocks.conf 
rocksdb.block_cache_size 256
rocksdb.metadata_block_cache_size 128
rocksdb.subkey_block_cache_size 128
root@rmas1:~# grep write_buffer kvrocks.conf 
rocksdb.write_buffer_size 64
rocksdb.max_write_buffer_number 4
```

I'm using kvrocks version 2.11.1

I have cascading replicas with a similar configuration. The topology is  
[master ---> cascading_replica ---> replica]

During a high volume of writes to the master, the memory usage increases in all 
three Kvrocks instances.

I loaded the master with a sizable database (~150MB) (~2mil keys) before doing 
the heavy writes.

Writes to master:

```
stuff=$(head -c 32000000 /dev/urandom | base64)
while true; do redis-cli -p 6666 -a $PASS set $(date --iso=ns) 
"${stuff:RANDOM:102400}"; sleep 0.001; done
```

Memory usage on cascading replica (not reported in rss_bytes metrics):

```
root@rmas2:~# systemctl status kvrocks --no-pager | grep Memo
     Memory: 1.9G (high: 2.0G max: 2.0G available: 508.0K)
root@rmas2:~# curl -Ss localhost:9121/metrics | grep rss
# HELP kvrocks_memory_used_rss_bytes memory_used_rss_bytes metric
# TYPE kvrocks_memory_used_rss_bytes gauge
kvrocks_memory_used_rss_bytes 5.03590912e+08
```

On master:

```
root@rmas1:~# systemctl status kvrocks | grep Memo
     Memory: 2.0G
root@rmas1:~# curl -Ss localhost:9121/metrics | grep rss
# HELP kvrocks_memory_used_rss_bytes memory_used_rss_bytes metric
# TYPE kvrocks_memory_used_rss_bytes gauge
kvrocks_memory_used_rss_bytes 5.19061504e+08
```

On replica:

```
root@rmas3:~# systemctl status kvrocks --no-pager | grep Memo
     Memory: 1.1G
root@rmas3:~# curl -Ss localhost:9121/metrics | grep rss
# HELP kvrocks_memory_used_rss_bytes memory_used_rss_bytes metric
# TYPE kvrocks_memory_used_rss_bytes gauge
kvrocks_memory_used_rss_bytes 1.55181056e+08
```

GitHub link: 
https://github.com/apache/kvrocks/discussions/2767#discussioncomment-12472388

----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to: [email protected]

Reply via email to