summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2016-11-28 23:50:10 +0000
committerEric Wong <e@80x24.org>2016-11-28 23:50:10 +0000
commitd89381efe5b6f4d1233aba16907bb457ff5f1f13 (patch)
tree914286b69d47182359f52ca5adc0ed208af14e9a
parent0383705344aa45970f0f799078a9b138202a8c6f (diff)
This probably applies to other kernels, too, but I'm most
familiar with Linux.
-rw-r--r--TUNING20
1 files changed, 19 insertions, 1 deletions
diff --git a/TUNING b/TUNING
index 247090b..b8cba8c 100644
--- a/TUNING
+++ b/TUNING
@@ -72,10 +72,28 @@ See Unicorn::Configurator for details on the config file format.
   have them unbuffered (File#sync = true) or they are
   record(line)-buffered in userspace before any writes.
 
-== Kernel Parameters (Linux sysctl)
+== Kernel Parameters (Linux sysctl and sysfs)
 
 WARNING: Do not change system parameters unless you know what you're doing!
 
+* Transparent hugepages (THP) improves performance in many cases,
+  but can also increase memory use when relying on a
+  copy-on-write(CoW)-friendly GC (Ruby 2.0+) with "preload_app true".
+  CoW operates at the page level, so writing to a huge page would
+  trigger a 2 MB copy (x86-64), as opposed to a 4 KB copy on a
+  regular (non-huge) page.
+
+  Consider only allowing THP to be used when it is requested via the
+  madvise(2) syscall:
+
+        echo madvise >/sys/kernel/mm/transparent_hugepage/enabled
+
+  Or disabling it system-wide, via "never".
+
+  n.b. "page" in this context only applies to the OS kernel,
+  Ruby GC implementations also use this term for the same concept
+  in a way that is agnostic to the OS.
+
 * net.core.rmem_max and net.core.wmem_max can increase the allowed
   size of :rcvbuf and :sndbuf respectively. This is mostly only useful
   for UNIX domain sockets which do not have auto-tuning buffer sizes.