Reputation: 11
I have several databases in Redis and I want to determine how much each of them takes up in RAM individually.
In Redis documentation there is a command INFO https://redis.io/commands/info but it gives out information on the occupied memory entirely, without splitting into existing databases.
There are also libraries like https://github.com/snmaynard/redis-audit, which essentially exploit the KEYS *
command, and then manual calculation.
Is there a built-in ability in Redis to monitor the current value of the memory occupied by each database separately, or maybe there are libraries for this, that are not based on the KEYS *
command?
Upvotes: 1
Views: 218
Reputation: 1155
Redis do not offer the separate database memory used. Usually, we attention more on all memory used because of performance.
If your keys and values have less difference in each database, you can use DBSIZE
command to sum each database keys, without KEYS *
command.
Do not forget SELECT n
before DBSIZE
command.
Upvotes: 0