Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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)?

share|improve this question

3 Answers 3

up vote 3 down vote accepted

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).

share|improve this answer
    
Looks like you are right. Unfortunately :) Could you please recommend me some hoster with reasonable pricing and without such surprises? –  Idsa Jul 20 '11 at 6:14
    
Also I have found my hoster uses Parallels virtualization. Is more like OpenVZ or Xen? –  Idsa 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/… –  Idsa 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.

share|improve this answer
    
"Permisson denied" :) –  Idsa Jul 20 '11 at 10:22
    
And it was under root –  Idsa 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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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