Managing Redis Kernel Parameter using Moonshine Sysctl Plugin


I manage my Rails 4.x App on Linode using Moonshine. Moonshine Sysctl Plugin automates managing the kernel parameter setting for redis.

What is sysctl in Linux?

sysctl is used to configure kernel parameters at runtime

Why do we need to use sysctl?

From Redis FAQ : Setting overcommit_memory to 1 says Linux to relax and perform the fork in a more optimistic allocation fashion, and this is indeed what you want for Redis.

Install Moonshine Sysctl Plugin

In the Rails project directory, run:

$ plugger install  git://

Here is the output:

DEPRECATION WARNING: `#silence_stderr` is deprecated and will be removed in the next release. (called from load at /Users/zepho/.rvm/gems/ruby-2.3.0@lafon/bin/plugger:23)
Initialized empty Git repository in /Users/zepho/projects/lafon/vendor/plugins/moonshine_sysctl/.git/
remote: Counting objects: 13, done.
remote: Compressing objects: 100% (10/10), done.
remote: Total 13 (delta 0), reused 10 (delta 0), pack-reused 0
Unpacking objects: 100% (13/13), done.
From git://
 * branch            HEAD       -> FETCH_HEAD

Configure Moonshine

In application_manifest.rb, add:

recipe :sysctl

In moonshine.yml, add:

  vm.overcommit_memory: 1

Deploy your Rails 4.x app.

Check Sysctl Values

SSH into the box and run:

$ sysctl vm.overcommit_memory
vm.overcommit_memory = 1

You can see the vm.overcommit_memory value is set to 1.


In this article, you learned how to set the vm.overcommit_memory value using sysctl Moonshine plugin so that Redis can function well.

Related Articles

Ace the Technical Interview

  • Easily find the gaps in your knowledge
  • Get customized lessons based on where you are
  • Take consistent action everyday
  • Builtin accountability to keep you on track
  • You will solve bigger problems over time
  • Get the job of your dreams

Take the 30 Day Coding Skills Challenge

Gain confidence to attend the interview

No spam ever. Unsubscribe anytime.