{"id":74,"date":"2012-08-14T20:34:00","date_gmt":"2012-08-14T20:34:00","guid":{"rendered":"https:\/\/www.tech-and-dev.com\/blog\/2012\/08\/14\/increase-shared-memory-on-linux-shmmax\/"},"modified":"2021-02-22T00:59:26","modified_gmt":"2021-02-22T00:59:26","slug":"increase-shared-memory-on-linux-shmmax","status":"publish","type":"post","link":"https:\/\/www.tech-and-dev.com\/blog\/2012\/08\/increase-shared-memory-on-linux-shmmax.html","title":{"rendered":"Increase shared memory on linux (shmmax)"},"content":{"rendered":"<p><a style=\"clear: left; float: left; margin-bottom: 1em; margin-right: 1em;\" href=\"https:\/\/www.tech-and-dev.com\/blog\/wp-content\/uploads\/2021\/02\/1_linuxpenguin.png\"><img decoding=\"async\" title=\"Shared memory on linux shmmax\" src=\"https:\/\/www.tech-and-dev.com\/blog\/wp-content\/uploads\/2021\/02\/1_linuxpenguin.png\" alt=\"Linux Shared memory shmmax\" border=\"0\" \/><\/a>Shared memory is often used in many applications on linux such as Oracle, Tibco, Webmethods. It&#8217;s also used for php extensions such as eaccelerator.<\/p>\n<p>In this tutorial, I will show you how to increase the shared memory limit permanently.<\/p>\n<p>The shared memory is stored in the following file: <i>\/proc\/sys\/kernel\/shmmax<\/i><\/p>\n<p>To check the size of your shmmax, write the following command:<\/p>\n<div style=\"background-color: black; color: white; padding: 5px; text-align: justify;\">cat \/proc\/sys\/kernel\/shmmax<\/div>\n<p>you will see the number of maximum shared memory in bytes.<\/p>\n<p>There are three ways to change the maximum limit. In the below examples, I will set the maximum shared memory to 64 MB (64 * 1024 * 1024 = 67108864)<\/p>\n<h4><b>First Method<\/b><\/h4>\n<p>This method is not permanent and will be reset once the server is rebooted<b>:<\/b><\/p>\n<div style=\"background-color: black; color: white; padding: 5px; text-align: justify;\">echo 67108864 &gt; \/proc\/sys\/kernel\/shmmax<\/div>\n<p>&nbsp;<\/p>\n<h4><b>Second Method<\/b><\/h4>\n<p>This method is permenant, the file sysctl.conf will be loaded during the boot process<b>:<\/b><\/p>\n<div style=\"background-color: black; color: white; padding: 5px; text-align: justify;\">echo &#8220;kernel.shmmax=67108864&#8221; &gt;&gt; \/etc\/sysctl.conf<\/div>\n<p>&nbsp;<\/p>\n<h4><b>Third Method<\/b><\/h4>\n<p>This method is also permanent, but requires to edit the sysctl.conf directly<b>:<\/b><\/p>\n<div style=\"background-color: black; color: white; padding: 5px; text-align: justify;\">vi \/etc\/sysctl.conf<\/div>\n<p>and append the following:<\/p>\n<div style=\"background-color: black; color: white; padding: 5px; text-align: justify;\">kernel.shmmax=67108864<\/div>\n<p>Make sure to save the file using :<b>w<\/b><\/p>\n<p>If you use the <b>second <\/b>or <b>third<\/b> method, you will need to restart your server for the changes to take effects.<br \/>\nTo restart your server, write the following command:<\/p>\n<div style=\"background-color: black; color: white; padding: 5px; text-align: justify;\">\/sbin\/reboot<\/div>\n<p>or:<\/p>\n<div style=\"background-color: black; color: white; padding: 5px; text-align: justify;\">\/sbin\/shutdown -r now<\/div>\n<p><b>Any questions? Leave us a comment below!<\/b><\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Shared memory is often used in many applications on linux such as Oracle, Tibco, Webmethods. It&#8217;s also used for php extensions such as eaccelerator. In this tutorial, I will show you how to increase the shared memory limit permanently. The shared memory is stored in the following file: \/proc\/sys\/kernel\/shmmax To check the size of your [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[97,6,99,100,98,7],"tags":[],"class_list":["post-74","post","type-post","status-publish","format-standard","hentry","category-eaccelerator","category-linux","category-memory","category-operating-system","category-oracle","category-ssh"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.tech-and-dev.com\/blog\/wp-json\/wp\/v2\/posts\/74","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.tech-and-dev.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.tech-and-dev.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.tech-and-dev.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.tech-and-dev.com\/blog\/wp-json\/wp\/v2\/comments?post=74"}],"version-history":[{"count":2,"href":"https:\/\/www.tech-and-dev.com\/blog\/wp-json\/wp\/v2\/posts\/74\/revisions"}],"predecessor-version":[{"id":187,"href":"https:\/\/www.tech-and-dev.com\/blog\/wp-json\/wp\/v2\/posts\/74\/revisions\/187"}],"wp:attachment":[{"href":"https:\/\/www.tech-and-dev.com\/blog\/wp-json\/wp\/v2\/media?parent=74"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.tech-and-dev.com\/blog\/wp-json\/wp\/v2\/categories?post=74"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tech-and-dev.com\/blog\/wp-json\/wp\/v2\/tags?post=74"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}