I'm running:
Ubuntu 10.04 LTS Server AMD64 in a 512MB XEN paravirtualized environment.
lighttpd v1.4.26
PHP v5.3.8
MySQL v5.1.41-3ubuntu12
The issue is:
I first started on a '256MB account' which is a lie as it registers as 245MB using free -m I found that after I got the system up and running, the memory started slowly disappearing which I later learned was the disk to memory cache/buffer but it still made me nervous as it looked like a memory leak. Sure enough, when it reached the max memory the server crashed. I thought that it was maybe something wrong with my code or that I was using a buggy version of the new PHP. So i changed my cloud size from 256 to 512, which is also a lie, as it reports as 496MB and let that run. After a week, the memory filled up again and the server crashed.
For reference I am not using drupal or php-nuke or anything pre-bundled or bloated. I tried force upgrading from the maximum PHP v5.3.2 LTS release to 5.3.8 My swappiness is set to the default 60.
here is my memory as it sits now:
total used free shared buffers cached
Mem: 496 187 308 0 32 65
-/+ buffers/cache: 89 406
Swap: 1023 0 1023
The site stays at the 89MB level almost always, but the buffers and cached keep raising.
my workaround is I created a daily cron with echo 3 > /proc/sys/vm/drop_caches
.
This has worked for 3 weeks now but I'm worried that once the site goes mainstream that this hack method will fail. I am here to ask you guys out there that know much more than I do about this scenario, what should I do next?
I'm totally willing to get any data you need to help diagnose this.
My personal hunch is an incompatibility with XEN and Ubuntu, as my guess is XEN says there is a real 512MB of memory to use when its only 496, or that XEN says there is 16GB of memory to use as its incorrect proportioning of the VM. No idea how to confirm that.