I have a Parallels VPS with 1GB of RAM. Okay, hoster says it has 1GB but I can't check it as "free" and other similar commands return 13Gb which I guess is a size of physical memory.

When I execute top command I see the following output: output from top

As you see mysql is the one process which uses significant size of RAM (143M). And the total size of used RAM is about 160M. The problem is I can't use more memory: if I extend some memore settings (for example, for mysql) I get "not enough memory", "can't allocate memory", etc.

I have two guesses:

  1. My VPS doesn't have 1GB of RAM
  2. If you look to virtual memory usage, it is much closer to 1GB. But at the same time swap size is zero. So is all my virtual stored in RAM? I expected swap to be the difference between virtual memory and RAM usage.

Any other ideas how I can use more memory for mysql (I wanted to use about 80% of 1Gb)?


You have a Virtuozzo (or OpenVZ) VPS -- for which the normal rules of memory allocation don't apply. Assuming your hosting provider isn't lying to you, you "have" 1GB of RAM, insofar as the OpenVZ "hypervisor" will allow you to allocate 1GB of memory, or (more likely, based on your description of events) 1GB of virtual memory.

Just because you don't see any swap in top, it doesn't mean that all your data is in physical memory -- the rules are different (very, very different) for OpenVZ.

If you want to use more memory for MySQL, then you'll have to reduce the amount of memory that other things in your VM are using. Your top output doesn't list any obvious contenders, but if you sort it by memory usage, you'll get a much better idea of what's superfluous (and will give you the best bang for the buck).

As an aside, I'd recommend getting away from your current hosting provider -- while OpenVZ has it's place, that place isn't in the VPS hosting market. You probably picked them because they were a cheap provider, but you're learning why they're cheap -- OpenVZ is a very restricted platform, with it's own rather peculiar set of quirks. You're much better off with a provider of "real" VPSes (someone using Xen, KVM, VMWare, etc).

  • Looks like you are right. Unfortunately :) Could you please recommend me some hoster with reasonable pricing and without such surprises? Jul 20 '11 at 6:14
  • Also I have found my hoster uses Parallels virtualization. Is more like OpenVZ or Xen? Jul 20 '11 at 6:58
  • Parallels is the new markety name for Virtuozzo, which is the commercially supported version of OpenVZ. I can't recommend a hosting provider, Server Fault isn't a shopping site.
    – womble
    Jul 20 '11 at 7:04
  • Okay, thank you! For those who is also interested in this question, I will put this article here: moeding.net/archives/… Jul 20 '11 at 10:22

In addition to what has already been said, you might want to check /proc/user_beancounters, which holds information about the resource consumptions of your VPS.

  • "Permisson denied" :) Jul 20 '11 at 10:22
  • And it was under root Jul 20 '11 at 10:26

I also found out there is a way to reduce virtual memory size by limiting default stack size. I would recommend this article and this forum post.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.