{"id":6798,"date":"2014-04-23T08:06:49","date_gmt":"2014-04-23T08:06:49","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/04\/23\/more-than-half-of-the-memory-in-use-right-after-rebooting-collection-of-common-programming-errors\/"},"modified":"2014-04-23T08:06:49","modified_gmt":"2014-04-23T08:06:49","slug":"more-than-half-of-the-memory-in-use-right-after-rebooting-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/04\/23\/more-than-half-of-the-memory-in-use-right-after-rebooting-collection-of-common-programming-errors\/","title":{"rendered":"More than half of the memory in use right after rebooting-Collection of common programming errors"},"content":{"rendered":"<p>I am trying to do some tests with Azul&#8217;s ZingVM, which needs to pre-allocate large amount of ram.<\/p>\n<p>The problem is, on my server (running Cent OS 5.8) which has 16GB ram, more than 8GB will be used right after rebooting&#8230; like this (I reboot the server, ssh login to it, and run <code>free -m<\/code> at once):<\/p>\n<pre><code>             total       used       free     shared    buffers     cached\nMem:         16048       8281       7767          0          1         19\n-\/+ buffers\/cache:       8260       7788\nSwap:        18047          0      18047\n<\/code><\/pre>\n<p>Obviously the buffers and cached don&#8217;t contribute to the used 8GB ram. This is an application server which runs Apache Tomcat everyday (for tests), and I am sure that the Tomcat won&#8217;t be started automatically.<\/p>\n<p>I tried to find out which process is using such a large amount of memory with <code>top<\/code>, but only to find that the top-RES-using process only uses 4460k&#8230;<\/p>\n<p>However I have another server (with Cent OS 5.8) running mysql. The memory usage of this database sever is normal. Now I am testing ZVM on the database server, and with Zing allocating 65% ram on startup, after a fresh rebooting, the <code>free -m<\/code> shows:<\/p>\n<pre><code>             total       used       free     shared    buffers     cached\nMem:         16048      10942       5105          0          3         55\n-\/+ buffers\/cache:      10883       5165\nSwap:        18047          0      18047\n<\/code><\/pre>\n<p>So&#8230; If we ignore the 65% of 16GB &#8212; about 10GB &#8212; used by Zing, the used memory after rebooting should be just several MBs.<\/p>\n<p>Now I am just testing if I can get Tomcat working under ZingVM. Then I need to run real tests on another two Cent OS servers, and unfortunately, those two servers have the same problem. That is to say, we have 4 servers, and 3 servers have this problem.<\/p>\n<p><strong>What may be the reason of this problem? Can I resolve it without re-installing the OS on those machines?<\/strong><\/p>\n<p><strong>Update:<\/strong><\/p>\n<p>here is what zing-system-tool reports when I try to set it to use <strong>75%<\/strong>(it&#8217;s default value) of the memory. Exactly the same pattern of output when I specify 85%.<\/p>\n<pre><code>Fatal error:  Not enough free memory (memoryForAzulBytes (12620660736) &gt; MemFree (8142327808)).\nzing-memory: ERROR: Configure pmem failed\nFatal error:  os::safeSystem:  command '\/sbin\/service zing-memory restart' failed.\n<\/code><\/pre>\n<p>And here is a successful allocation on the database server (I specified 68% this time, and the old value is 65%; ZST will release the memory reserved by itself):<\/p>\n<pre><code>Info:  azulPmemPages: 5456.\nINFO: az_pmem_reserve_pages (num2mPages 5456) succeeded\nINFO: az_pmem_fund_transfer (to 7, from 0, bytes 11442061312) succeeded\nINFO: az_pmem_fund_transfer (to 1, from 7, bytes 570425344) succeeded\nINFO: az_pmem_fund_transfer (to 3, from 7, bytes 570425344) succeeded\nINFO: az_pmem_fund_transfer (to 0, from 7, bytes 10301210624) succeeded\nInfo:  You can now start Java processes up to -Xmx9824m or -Xmx9g.\nInfo:  Azul pmem initialized successfully.\nzing-memory: INFO: start successful\nzing-memory: INFO: restart successful\n<\/code><\/pre>\n<p><strong>Update 2:<\/strong><\/p>\n<p>I saw this in \/proc\/meminfo on the problematic server:<\/p>\n<pre><code>HugePages_Total:  4096\nHugePages_Free:   4096\nHugePages_Rsvd:      0\nHugepagesize:     2048 kB\n<\/code><\/pre>\n<p>while on the database server, it&#8217;s all 0. <strong>Could this be the reason of the used memory?<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I am trying to do some tests with Azul&#8217;s ZingVM, which needs to pre-allocate large amount of ram. The problem is, on my server (running Cent OS 5.8) which has 16GB ram, more than 8GB will be used right after rebooting&#8230; like this (I reboot the server, ssh login to it, and run free -m [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-6798","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/6798","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=6798"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/6798\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=6798"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=6798"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=6798"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}