A few hours ago, Salvatore Sanfilippo (the lead developer of Redis), tweeted a little Ruby script to interactively estimate the memory usage of a running redis-server instance:

I've been experimenting with a Python+Redis combination (with redis-py) for data analysis on a few side projects lately, and a simple script like this can come in handy when you want to make sure you're not doing something completely stupid with Redis that gobbles up all of the allocated memory. And yes, I've been guilty of doing that on a few occasions.

Converting the script from Ruby to Python (with some additional logic for command line option parsing) is very straightforward: