Skip to content

Instantly share code, notes, and snippets.

@gtd
gtd / simple_redis_profile.rb
Created September 29, 2011 12:23 — forked from joeyAghion/simple_redis_profile.rb
By sampling keys from your redis databases, this script tries to identify what types of keys are occupying the most memory.
#!/usr/bin/env ruby
# Evaluates a sample of keys/values from each redis database, computing statistics for each key pattern:
# keys: number of keys matching the given pattern
# size: approximation of the associated memory occupied (based on size/length of value)
# percent: the proportion of this 'size' relative to the sample's total
#
# Copyright Weplay, Inc. 2010. Available for use under the MIT license.