Can't allocate cached memory on OpenVZ
I ran into a problem that forced me to upgrade my plan to a higher one. I kept getting "out of memory" errors even though
free command reported enough memory (if cache was included) to run a program. Today I remembered about this issue and did a little research. Here's what I found.
According to linuxatemyram.com, kernel should allow other programs to allocate cached memory. But on my VPS it doesn't. To prove it I ran a little program from here that allocates all available memory. Here are the results:
$ free -m total used free shared buffers cached Mem: 2048 1030 1017 0 0 461 -/+ buffers/cache: 568 1479 Swap: 0 0 0 $ ./bin/munch (...) Allocated 961 MB $ free -m total used free shared buffers cached Mem: 2048 1032 1015 0 0 464 -/+ buffers/cache: 568 1479 Swap: 0 0 0
As you can see, the program can only allocate unused memory but it should also be able to allocate cached memory.
I wrote about it to my hoster's support and here's their answer:
We use standard OpenVZ kernel with standard setting and standard SolusVM
installation for VPS providing, so our VPs servers runs in the same way
as any other provider OpenVZ based VPS servers.
This includes also cache memory usage etc. We have not received any
other complain about memory usage or cache memory etc in a whole active
period of our services. This means that if there is any memory issue
(your guess that there is any) then this may be isolated and affected
only in your VPS server.
There is no memory or cache memory issues from our side related to
So I think there are three possible answers to this issue:
- That's a normal behavior for OpenVZ.
- Something is wrong with my VPS.
- My hoster is a douche and forces its clients to buy more expensive plans.
Which one is it? Or maybe it's something else? I honestly don't know.
Some details about my VPS:
- Debian Wheezy 32bit template, most likely official and unmodified. I also had this problem with Squeeze template.
- Kernel 2.6.32-042stab085.17.
- 2 Gb RAM (was 1 Gb, but I had to upgrade), no burst, no swap.
- No system tweaks.
I want to hear opinion of people that are more experienced with OpenVZ VPS.