Databases
bash
Intermediate
Redis Memory Usage Report
Report the top 20 Redis keys by memory usage using MEMORY USAGE command.
bash
#!/bin/bash
redis-cli --no-auth-warning -u ${REDIS_URL} \
SCAN 0 COUNT 1000 | tail -n +2 | \
xargs -I{} sh -c 'printf "%s %s
" $(redis-cli MEMORY USAGE {}) {}' | \
sort -rn | head -20
Prerequisites
- redis-cli
- Redis >= 4
Pro Tips
- → Run OBJECT ENCODING key to see per-key data structure.
Commercial Licensing
Acquire a production access token or template license for enterprise deployment.
Module Info
- Language
- bash
- Level
- Intermediate
- Read time
- 3 min
- Published
- Feb 2026
- License
- Commercial License
Newsletter
New modules every week, directly to your inbox.
Similar Modules
MySQL Replication Status Check
Script to check MySQL/MariaDB replication lag and alert if it exceeds threshold.
sql
·
Intermediate
DB Connection Pool Monitor
Query to check active connections, idle connections and pool usage in PostgreSQL.
sql
·
Intermediate
Cursor-based Pagination Query
Implement cursor-based (keyset) pagination in SQL — faster than OFFSET for large tables.
sql
·
Intermediate