Hi Nirmal, I've also observed this behavior. This results in unnecessary scaling up even though actual memory consumption is low.
+1 for calculating average physical memory consumption. However, will there be cases where we might want to consider physical + cached memory consumption when calculating average mem. consumption? I think we should clearly document this. On Sun, Jul 20, 2014 at 10:42 PM, Nirmal Fernando <nirmal070...@gmail.com> wrote: > I've noticed that the average memory consumption value calculated by > Cartridge Agent is a higher value (70-100%) even when the servers are idle. > While investigating this problem, learnt that Java OperatingSystemMXBean > isn't useful in Linux case, due to the fact that linux kernel caches a large > amount of memory internally. You can notice this using the free command. > > [stratos@414002071406 ~]$ free -m > total used free shared buffers cached > Mem: 7337 7242 94 0 174 5903 > -/+ buffers/cache: 1164 6173 > Swap: 0 0 0 > > In the above example, if we use methods in OperatingSystemMXBean API, it'll > give a memory consumption value of 98%. But if you take cached memory into > consideration, the real memory consumption value is 16%. > > I'll commit this fix soon. > > -- > Best Regards, > Nirmal > > Nirmal Fernando. > PPMC Member & Committer of Apache Stratos, > Senior Software Engineer, WSO2 Inc. > > Blog: http://nirmalfdo.blogspot.com/ -- Akila Ravihansa Perera Software Engineer WSO2 Inc. http://wso2.com Phone: +94 77 64 154 38 Blog: http://ravihansa3000.blogspot.com