When to turn off Transparent Huge Pages for redis












5















According to redis docs, it's advisable to disable Transparent Huge Pages.



Would the guidance be the same if the machine was shared between the redis server and the application.



Moreover, for other technologies, I've also read guidance that THP should be disabled for all production environments when setting up the server. Is this kind of pre-emptiveness applicable to redis as well, or one must first strictly monitor latency issues before deciding to turn off THP?










share|improve this question



























    5















    According to redis docs, it's advisable to disable Transparent Huge Pages.



    Would the guidance be the same if the machine was shared between the redis server and the application.



    Moreover, for other technologies, I've also read guidance that THP should be disabled for all production environments when setting up the server. Is this kind of pre-emptiveness applicable to redis as well, or one must first strictly monitor latency issues before deciding to turn off THP?










    share|improve this question

























      5












      5








      5








      According to redis docs, it's advisable to disable Transparent Huge Pages.



      Would the guidance be the same if the machine was shared between the redis server and the application.



      Moreover, for other technologies, I've also read guidance that THP should be disabled for all production environments when setting up the server. Is this kind of pre-emptiveness applicable to redis as well, or one must first strictly monitor latency issues before deciding to turn off THP?










      share|improve this question














      According to redis docs, it's advisable to disable Transparent Huge Pages.



      Would the guidance be the same if the machine was shared between the redis server and the application.



      Moreover, for other technologies, I've also read guidance that THP should be disabled for all production environments when setting up the server. Is this kind of pre-emptiveness applicable to redis as well, or one must first strictly monitor latency issues before deciding to turn off THP?







      redis






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 4 '17 at 2:51









      Hassan BaigHassan Baig

      4,31983181




      4,31983181
























          3 Answers
          3






          active

          oldest

          votes


















          2














          Turn it off. The problem lies in how THP shifts memory around to try and keep or create contiguous pages. Some applications can tolerate this, most databases cannot and it causes intermittent performance problems, some pretty bad. This is not unique to Redis by any means.



          For your application, especially if it is JAVA, set up real HugePages and leave the transparent variety out of it. If you do that just make sure you alocate memory correctly for the app and redis. Though I have to say, I probably would not recommend running both the app and redis on the same instance/server/vm.






          share|improve this answer
























          • Well to be exact, I've got a Django (Python) application, although I fathom that won't change anything vis-a-vis your answer, would it?

            – Hassan Baig
            Mar 4 '17 at 11:22











          • No, it would not.

            – Kirk
            Mar 5 '17 at 17:31











          • Thanks Kirk! Btw to further clarify, I need to do both echo never > /sys/kernel/mm/transparent_hugepage/enabled and echo never > /sys/kernel/mm/transparent_hugepage/defrag, correct?

            – Hassan Baig
            Mar 6 '17 at 0:09











          • Moreover, in your experience, does req/s throughput suffer as a result of turning off THP?

            – Hassan Baig
            Mar 6 '17 at 1:10













          • More than likely, you need both places. You will need to have some kind of init script that starts on boot that will do it every time.

            – Kirk
            Mar 6 '17 at 21:27



















          0














          The overhead THP imposes occurs only during memory allocation, because of defragmentation costs.



          If your redis instance has a (near-)constant memory footprint, you can only benefit from THP. Same applies to java or any other long-lived service that does its own memory management. Pre-allocate memory once and benefit.






          share|improve this answer

































            -4














            why playing such echo-games when there is a kernel-param you can boot with?



            transparent_hugepage=never






            share|improve this answer
























            • not sure why this answer got downvoted. Here's another reference unix.stackexchange.com/a/99172/29023

              – chachan
              Jan 8 '18 at 17:22











            • perhaps you didn't need to call the other answer "echo-games" and show more details about what you wanted to say as the link above

              – chachan
              Jan 8 '18 at 17:24











            • sorry, but when one is not capable to copy&paste "transparent_hugepage=never" into Google or don't know what a kernel parameter is he's not the audience anyways

              – Harald Reindl
              Jan 9 '18 at 18:00











            • Simple. The OP raised a number of concerns and none of them were addressed by this answer.

              – Amir
              Aug 19 '18 at 11:39











            • i refered to "echo never > /sys/kernel" which is not persistent while "transparent_hugepage=never" as kenerl param is a) persistent and b) as early as possible set

              – Harald Reindl
              Aug 20 '18 at 12:05











            Your Answer






            StackExchange.ifUsing("editor", function () {
            StackExchange.using("externalEditor", function () {
            StackExchange.using("snippets", function () {
            StackExchange.snippets.init();
            });
            });
            }, "code-snippets");

            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "1"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f42591511%2fwhen-to-turn-off-transparent-huge-pages-for-redis%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            3 Answers
            3






            active

            oldest

            votes








            3 Answers
            3






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            2














            Turn it off. The problem lies in how THP shifts memory around to try and keep or create contiguous pages. Some applications can tolerate this, most databases cannot and it causes intermittent performance problems, some pretty bad. This is not unique to Redis by any means.



            For your application, especially if it is JAVA, set up real HugePages and leave the transparent variety out of it. If you do that just make sure you alocate memory correctly for the app and redis. Though I have to say, I probably would not recommend running both the app and redis on the same instance/server/vm.






            share|improve this answer
























            • Well to be exact, I've got a Django (Python) application, although I fathom that won't change anything vis-a-vis your answer, would it?

              – Hassan Baig
              Mar 4 '17 at 11:22











            • No, it would not.

              – Kirk
              Mar 5 '17 at 17:31











            • Thanks Kirk! Btw to further clarify, I need to do both echo never > /sys/kernel/mm/transparent_hugepage/enabled and echo never > /sys/kernel/mm/transparent_hugepage/defrag, correct?

              – Hassan Baig
              Mar 6 '17 at 0:09











            • Moreover, in your experience, does req/s throughput suffer as a result of turning off THP?

              – Hassan Baig
              Mar 6 '17 at 1:10













            • More than likely, you need both places. You will need to have some kind of init script that starts on boot that will do it every time.

              – Kirk
              Mar 6 '17 at 21:27
















            2














            Turn it off. The problem lies in how THP shifts memory around to try and keep or create contiguous pages. Some applications can tolerate this, most databases cannot and it causes intermittent performance problems, some pretty bad. This is not unique to Redis by any means.



            For your application, especially if it is JAVA, set up real HugePages and leave the transparent variety out of it. If you do that just make sure you alocate memory correctly for the app and redis. Though I have to say, I probably would not recommend running both the app and redis on the same instance/server/vm.






            share|improve this answer
























            • Well to be exact, I've got a Django (Python) application, although I fathom that won't change anything vis-a-vis your answer, would it?

              – Hassan Baig
              Mar 4 '17 at 11:22











            • No, it would not.

              – Kirk
              Mar 5 '17 at 17:31











            • Thanks Kirk! Btw to further clarify, I need to do both echo never > /sys/kernel/mm/transparent_hugepage/enabled and echo never > /sys/kernel/mm/transparent_hugepage/defrag, correct?

              – Hassan Baig
              Mar 6 '17 at 0:09











            • Moreover, in your experience, does req/s throughput suffer as a result of turning off THP?

              – Hassan Baig
              Mar 6 '17 at 1:10













            • More than likely, you need both places. You will need to have some kind of init script that starts on boot that will do it every time.

              – Kirk
              Mar 6 '17 at 21:27














            2












            2








            2







            Turn it off. The problem lies in how THP shifts memory around to try and keep or create contiguous pages. Some applications can tolerate this, most databases cannot and it causes intermittent performance problems, some pretty bad. This is not unique to Redis by any means.



            For your application, especially if it is JAVA, set up real HugePages and leave the transparent variety out of it. If you do that just make sure you alocate memory correctly for the app and redis. Though I have to say, I probably would not recommend running both the app and redis on the same instance/server/vm.






            share|improve this answer













            Turn it off. The problem lies in how THP shifts memory around to try and keep or create contiguous pages. Some applications can tolerate this, most databases cannot and it causes intermittent performance problems, some pretty bad. This is not unique to Redis by any means.



            For your application, especially if it is JAVA, set up real HugePages and leave the transparent variety out of it. If you do that just make sure you alocate memory correctly for the app and redis. Though I have to say, I probably would not recommend running both the app and redis on the same instance/server/vm.







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Mar 4 '17 at 5:13









            KirkKirk

            2,0261120




            2,0261120













            • Well to be exact, I've got a Django (Python) application, although I fathom that won't change anything vis-a-vis your answer, would it?

              – Hassan Baig
              Mar 4 '17 at 11:22











            • No, it would not.

              – Kirk
              Mar 5 '17 at 17:31











            • Thanks Kirk! Btw to further clarify, I need to do both echo never > /sys/kernel/mm/transparent_hugepage/enabled and echo never > /sys/kernel/mm/transparent_hugepage/defrag, correct?

              – Hassan Baig
              Mar 6 '17 at 0:09











            • Moreover, in your experience, does req/s throughput suffer as a result of turning off THP?

              – Hassan Baig
              Mar 6 '17 at 1:10













            • More than likely, you need both places. You will need to have some kind of init script that starts on boot that will do it every time.

              – Kirk
              Mar 6 '17 at 21:27



















            • Well to be exact, I've got a Django (Python) application, although I fathom that won't change anything vis-a-vis your answer, would it?

              – Hassan Baig
              Mar 4 '17 at 11:22











            • No, it would not.

              – Kirk
              Mar 5 '17 at 17:31











            • Thanks Kirk! Btw to further clarify, I need to do both echo never > /sys/kernel/mm/transparent_hugepage/enabled and echo never > /sys/kernel/mm/transparent_hugepage/defrag, correct?

              – Hassan Baig
              Mar 6 '17 at 0:09











            • Moreover, in your experience, does req/s throughput suffer as a result of turning off THP?

              – Hassan Baig
              Mar 6 '17 at 1:10













            • More than likely, you need both places. You will need to have some kind of init script that starts on boot that will do it every time.

              – Kirk
              Mar 6 '17 at 21:27

















            Well to be exact, I've got a Django (Python) application, although I fathom that won't change anything vis-a-vis your answer, would it?

            – Hassan Baig
            Mar 4 '17 at 11:22





            Well to be exact, I've got a Django (Python) application, although I fathom that won't change anything vis-a-vis your answer, would it?

            – Hassan Baig
            Mar 4 '17 at 11:22













            No, it would not.

            – Kirk
            Mar 5 '17 at 17:31





            No, it would not.

            – Kirk
            Mar 5 '17 at 17:31













            Thanks Kirk! Btw to further clarify, I need to do both echo never > /sys/kernel/mm/transparent_hugepage/enabled and echo never > /sys/kernel/mm/transparent_hugepage/defrag, correct?

            – Hassan Baig
            Mar 6 '17 at 0:09





            Thanks Kirk! Btw to further clarify, I need to do both echo never > /sys/kernel/mm/transparent_hugepage/enabled and echo never > /sys/kernel/mm/transparent_hugepage/defrag, correct?

            – Hassan Baig
            Mar 6 '17 at 0:09













            Moreover, in your experience, does req/s throughput suffer as a result of turning off THP?

            – Hassan Baig
            Mar 6 '17 at 1:10







            Moreover, in your experience, does req/s throughput suffer as a result of turning off THP?

            – Hassan Baig
            Mar 6 '17 at 1:10















            More than likely, you need both places. You will need to have some kind of init script that starts on boot that will do it every time.

            – Kirk
            Mar 6 '17 at 21:27





            More than likely, you need both places. You will need to have some kind of init script that starts on boot that will do it every time.

            – Kirk
            Mar 6 '17 at 21:27













            0














            The overhead THP imposes occurs only during memory allocation, because of defragmentation costs.



            If your redis instance has a (near-)constant memory footprint, you can only benefit from THP. Same applies to java or any other long-lived service that does its own memory management. Pre-allocate memory once and benefit.






            share|improve this answer






























              0














              The overhead THP imposes occurs only during memory allocation, because of defragmentation costs.



              If your redis instance has a (near-)constant memory footprint, you can only benefit from THP. Same applies to java or any other long-lived service that does its own memory management. Pre-allocate memory once and benefit.






              share|improve this answer




























                0












                0








                0







                The overhead THP imposes occurs only during memory allocation, because of defragmentation costs.



                If your redis instance has a (near-)constant memory footprint, you can only benefit from THP. Same applies to java or any other long-lived service that does its own memory management. Pre-allocate memory once and benefit.






                share|improve this answer















                The overhead THP imposes occurs only during memory allocation, because of defragmentation costs.



                If your redis instance has a (near-)constant memory footprint, you can only benefit from THP. Same applies to java or any other long-lived service that does its own memory management. Pre-allocate memory once and benefit.







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Nov 26 '18 at 16:56

























                answered Nov 25 '18 at 17:42









                milanmilan

                1,36111630




                1,36111630























                    -4














                    why playing such echo-games when there is a kernel-param you can boot with?



                    transparent_hugepage=never






                    share|improve this answer
























                    • not sure why this answer got downvoted. Here's another reference unix.stackexchange.com/a/99172/29023

                      – chachan
                      Jan 8 '18 at 17:22











                    • perhaps you didn't need to call the other answer "echo-games" and show more details about what you wanted to say as the link above

                      – chachan
                      Jan 8 '18 at 17:24











                    • sorry, but when one is not capable to copy&paste "transparent_hugepage=never" into Google or don't know what a kernel parameter is he's not the audience anyways

                      – Harald Reindl
                      Jan 9 '18 at 18:00











                    • Simple. The OP raised a number of concerns and none of them were addressed by this answer.

                      – Amir
                      Aug 19 '18 at 11:39











                    • i refered to "echo never > /sys/kernel" which is not persistent while "transparent_hugepage=never" as kenerl param is a) persistent and b) as early as possible set

                      – Harald Reindl
                      Aug 20 '18 at 12:05
















                    -4














                    why playing such echo-games when there is a kernel-param you can boot with?



                    transparent_hugepage=never






                    share|improve this answer
























                    • not sure why this answer got downvoted. Here's another reference unix.stackexchange.com/a/99172/29023

                      – chachan
                      Jan 8 '18 at 17:22











                    • perhaps you didn't need to call the other answer "echo-games" and show more details about what you wanted to say as the link above

                      – chachan
                      Jan 8 '18 at 17:24











                    • sorry, but when one is not capable to copy&paste "transparent_hugepage=never" into Google or don't know what a kernel parameter is he's not the audience anyways

                      – Harald Reindl
                      Jan 9 '18 at 18:00











                    • Simple. The OP raised a number of concerns and none of them were addressed by this answer.

                      – Amir
                      Aug 19 '18 at 11:39











                    • i refered to "echo never > /sys/kernel" which is not persistent while "transparent_hugepage=never" as kenerl param is a) persistent and b) as early as possible set

                      – Harald Reindl
                      Aug 20 '18 at 12:05














                    -4












                    -4








                    -4







                    why playing such echo-games when there is a kernel-param you can boot with?



                    transparent_hugepage=never






                    share|improve this answer













                    why playing such echo-games when there is a kernel-param you can boot with?



                    transparent_hugepage=never







                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Dec 12 '17 at 22:29









                    Harald ReindlHarald Reindl

                    1




                    1













                    • not sure why this answer got downvoted. Here's another reference unix.stackexchange.com/a/99172/29023

                      – chachan
                      Jan 8 '18 at 17:22











                    • perhaps you didn't need to call the other answer "echo-games" and show more details about what you wanted to say as the link above

                      – chachan
                      Jan 8 '18 at 17:24











                    • sorry, but when one is not capable to copy&paste "transparent_hugepage=never" into Google or don't know what a kernel parameter is he's not the audience anyways

                      – Harald Reindl
                      Jan 9 '18 at 18:00











                    • Simple. The OP raised a number of concerns and none of them were addressed by this answer.

                      – Amir
                      Aug 19 '18 at 11:39











                    • i refered to "echo never > /sys/kernel" which is not persistent while "transparent_hugepage=never" as kenerl param is a) persistent and b) as early as possible set

                      – Harald Reindl
                      Aug 20 '18 at 12:05



















                    • not sure why this answer got downvoted. Here's another reference unix.stackexchange.com/a/99172/29023

                      – chachan
                      Jan 8 '18 at 17:22











                    • perhaps you didn't need to call the other answer "echo-games" and show more details about what you wanted to say as the link above

                      – chachan
                      Jan 8 '18 at 17:24











                    • sorry, but when one is not capable to copy&paste "transparent_hugepage=never" into Google or don't know what a kernel parameter is he's not the audience anyways

                      – Harald Reindl
                      Jan 9 '18 at 18:00











                    • Simple. The OP raised a number of concerns and none of them were addressed by this answer.

                      – Amir
                      Aug 19 '18 at 11:39











                    • i refered to "echo never > /sys/kernel" which is not persistent while "transparent_hugepage=never" as kenerl param is a) persistent and b) as early as possible set

                      – Harald Reindl
                      Aug 20 '18 at 12:05

















                    not sure why this answer got downvoted. Here's another reference unix.stackexchange.com/a/99172/29023

                    – chachan
                    Jan 8 '18 at 17:22





                    not sure why this answer got downvoted. Here's another reference unix.stackexchange.com/a/99172/29023

                    – chachan
                    Jan 8 '18 at 17:22













                    perhaps you didn't need to call the other answer "echo-games" and show more details about what you wanted to say as the link above

                    – chachan
                    Jan 8 '18 at 17:24





                    perhaps you didn't need to call the other answer "echo-games" and show more details about what you wanted to say as the link above

                    – chachan
                    Jan 8 '18 at 17:24













                    sorry, but when one is not capable to copy&paste "transparent_hugepage=never" into Google or don't know what a kernel parameter is he's not the audience anyways

                    – Harald Reindl
                    Jan 9 '18 at 18:00





                    sorry, but when one is not capable to copy&paste "transparent_hugepage=never" into Google or don't know what a kernel parameter is he's not the audience anyways

                    – Harald Reindl
                    Jan 9 '18 at 18:00













                    Simple. The OP raised a number of concerns and none of them were addressed by this answer.

                    – Amir
                    Aug 19 '18 at 11:39





                    Simple. The OP raised a number of concerns and none of them were addressed by this answer.

                    – Amir
                    Aug 19 '18 at 11:39













                    i refered to "echo never > /sys/kernel" which is not persistent while "transparent_hugepage=never" as kenerl param is a) persistent and b) as early as possible set

                    – Harald Reindl
                    Aug 20 '18 at 12:05





                    i refered to "echo never > /sys/kernel" which is not persistent while "transparent_hugepage=never" as kenerl param is a) persistent and b) as early as possible set

                    – Harald Reindl
                    Aug 20 '18 at 12:05


















                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f42591511%2fwhen-to-turn-off-transparent-huge-pages-for-redis%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Wiesbaden

                    Marschland

                    Dieringhausen