Saturday, August 25, 2012

Wrong defaults for zone_reclaim_mode on Linux

My coworker Jeff Frost just published a writeup on "zone reclaim mode" in Linux, and how it can be a problem.  Since his post is rather detailed, I wanted to give a "do this" summary:

  1. zone_reclaim_mode defaults to the wrong value for database servers, 1, on some Linux distributions, including Red Hat.
  2. This default will both cause Linux to fail to use all available RAM for caching, and throttle writes.
  3. If you're running PostgreSQL, make sure that zone_reclaim_mode is set to 0.
Frankly, given the documentation on how zone_reclaim_mode works, I'm baffled as to what kind of applications it would actually benefit.  Could this be another Linux misstep, like the OOM killer?

3 comments:

  1. This comment has been removed by the author.

    ReplyDelete
    Replies
    1. Defaults to zero on my system.

      $ cat /etc/redhat-release
      Red Hat Enterprise Linux Server release 6.3 (Santiago)

      $ uname -a
      Linux work-desktop 2.6.32-279.19.1.el6.x86_64 #1 SMP Sat Nov 24 14:35:28 EST 2012 x86_64 x86_64 x86_64 GNU/Linux

      $ cat /etc/sysctl.conf | grep zone

      $ cat /proc/sys/vm/zone_reclaim_mode
      0

      Delete
    2. After a little more looking, Both of us are correct. It can be different depending on the machine. HOpefully you can check view:

      https://access.redhat.com/site/solutions/60669

      To paraphrase:

      The commit 9eeff2395e3cfd05c9b2e6074ff943a34b0c5c21 introduced this.
      For more details, please check the upstream kernel discussion here : http://marc.info/?l=linux-kernel&m=113408418232531&w=2

      In RHEL-6.1 'zone_reclaim_mode' is set to 1 and in RHEL-6.2 it set back to 0.

      Delete