redis on davidchua https://dchua.com/tags/redis/ Recent content in redis on davidchua Hugo -- gohugo.io en-us Tue, 28 Apr 2015 00:00:00 +0000 Debugging Redis and its Memory https://dchua.com/posts/2015-04-28-debugging-redis-and-its-memory/ Tue, 28 Apr 2015 00:00:00 +0000 https://dchua.com/posts/2015-04-28-debugging-redis-and-its-memory/ To determine the size of a key redis-cli> DEBUG OBJECT <keyname> Value at:0x7ffc8f8eb330 refcount:1 encoding:linkedlist serializedlength:1175841791 lru:416416 lru_seconds_idle:30 serializedlength is in bytes. To print out the size of each key in your redis-database Checkout this script To tweak Redis from overloading your memory Add vm.overcommit_memory = 1 to /etc/sysctl.conf and then reboot or run the command sysctl vm.overcommit_memory=1 for this to take effect immediately. To limit the size of your redis database # /etc/redis/redis. Redis::InheritedError during RSpec/Spork Testing https://dchua.com/posts/2013-07-30-redisinheritederror-during-rspecspork-testing/ Tue, 30 Jul 2013 00:00:00 +0000 https://dchua.com/posts/2013-07-30-redisinheritederror-during-rspecspork-testing/ When testing an action that performs a redis-rb command on RSpec, you may run into an error: Redis::InheritedError (Tried to use a connection from a child process without reconnecting ... Solve it by adding the following into your spec_helper. # spec/spec_helper.rb RSpec.configure do |config| # ... config.before :all do $redis.client.reconnect end # ... end Saves me ton of time. Reference: Stackoverflow How to Redis from Source to Daemon https://dchua.com/posts/2013-07-23-how-to-redis-from-source-to-daemon/ Tue, 23 Jul 2013 00:00:00 +0000 https://dchua.com/posts/2013-07-23-how-to-redis-from-source-to-daemon/ Make sure you have a server. I’d recommend spinning up an Amazon EC2 instance. Grab the latest redis. At this point of writing, it is: $ wget http://redis.googlecode.com/files/redis-2.6.14.tar.gz $ tar xzf redis-2.6.14.tar.gz $ cd redis-2.6.14 You can do this in any directory, I recommend making a tmp/ directory in your home directory. Run a make and make test! $ make && make test Copy the redis/* content into a accessible folder.