brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: redis-cli --bigkeys finds the largest keys filling up your cache

Cache
~/tips/tip-cache-redis-bigkeys-scan-sampling

redis-cli --bigkeys -i 0.1

Scans a Redis instance and reports the biggest keys per type without blocking the server.

One huge key can hold most of the memory of a cache and block the server when it is deleted.

redis-cli --bigkeys -i 0.1
redis-cli --memkeys -i 0.1

--bigkeys walks the keyspace with SCAN and reports the biggest key of each type, measured in elements. --memkeys does the same by memory use. The -i 0.1 option sleeps 0.1 second per 100 SCAN commands to spare the server. Because SCAN is incremental, a key that changes while it runs can be missed or seen twice. Both options also work on cluster replicas, which keeps the load off the primary. Delete big keys with UNLINK, which frees the memory in the background.

Further reading: Redis CLI documentation

Going deeper: Guide: your Unraid cache is full and Docker stopped, how to find out why and fix it

More Cache tips fincore /var/lib/example/data.db npm cache verify fc-cache -f -v ~/.local/share/fonts proxy_cache app; Cache-Control: no-cache All Cache tips (24) All topics

Link