by antirez · 12y ago · 0 comments
EDIT: Oh wait... since the problem is huge pages, this is MUCH better, since we can disable it. And I just verified that it works:
echo never > /sys/kernel/mm/transparent_hugepage/enabled
This means, free latency upgrade for all the Redis users out there during fork... (more or less 20x in my tests) just with this line above.
the doc recommends adding "transparent_hugepage=never" to the kernel boot line in the "/etc/grub.conf" file.
[1] http://oracle-base.com/articles/linux/configuring-huge-pages...
[2] https://support.oracle.com/epmos/faces/DocContentDisplay?id=...
[3] http://blog.couchbase.com/often-overlooked-linux-os-tweaks
EDIT: Actually in the CouchBase case they talk about "page allocation delays" that looks related, potentially. I started the investigation mainly because the Stripe graph looked suspicious with a modern EC2 instance type that has good fork times, so there was something more indeed (unless the test was performed with tens of GB of data).
echo never > /sys/kernel/mm/transparent_hugepage/defrag
You were right! Please check: https://news.ycombinator.com/item?id=8553666
I would be interested if this also decreases latency for you:
echo 2 > /sys/kernel/mm/ksm/run
Also check stats here: /sys/kernel/mm/ksm/*
And some documentation here: https://www.kernel.org/doc/Documentation/vm/ksm.txt
Secondly, huge pages help to reduce memory latency for large data sets quite significantly.
How?
huge pages help to reduce memory latency
Yup, but this is about _transparent_ huge pages which break databases all over the place: https://blogs.oracle.com/linux/entry/performance_issues_with... and http://dev.nuodb.com/techblog/linux-transparent-huge-pages-j... and http://scn.sap.com/people/markmumy/blog/2014/05/22/sap-iq-an... and http://www.percona.com/blog/2014/07/23/why-tokudb-hates-tran... and (a dozen more including varnish, mongo, hadoop, ...)