Go Back   SolidHost Forums Support Forums Operating System Questions

Reply
 
Thread Tools Display Modes
Old May 17th, 2007, 13:07   #1
SH-John
Customer
 
Join Date: Jan 2007
Posts: 51
Default VPS memory explanation

Hello All,

We noticed that some customers are somewhat confused about the way memory is allocated. A linux VPS allocates RAM the same way as any other linux environment, however Virtuozzo's parameters (in the Power Panel) just look a little different. The biggest confusion previously was related to allocated(reserved) memory and assigned(used) memory.

Login to your Virtuozzo Power Panel and follow these steps.

Click on "Resources", then click on "Extended". Click on "Secondary UBC Parameters" and "Auxiliary UBC Parameters"

Privvmpages
  • Soft limit
    This limit defines the maximum amount of memory that your VPS can allocate. This limit is usually set to 262,144 pages. 1 page is 4kb, so this limit is set to 1,048,576kb which is equal to 1024Mb (or 1Gb).

  • Hard limit
    This limit is typically just slightly higher than the soft limit, to make sure that your VPS wouldn’t die in case the soft limit is reached.

  • Current use
    This is the amount of memory that your VPS has currently allocated (note: allocated ram basically means “reserved” ram – it is not all actually being used).

Oomguarpages
  • Soft limit
    Despite what the name of this parameter implies, this number isn’t a limit, but a guarantee. This number is the guaranteed ram that’ll always be available to your VPS, no matter what happens.

  • Hard limit
    This parameter is always set to 2,147,483,647 – which basically means “indefinite”. In other words: this parameter isn’t being used by anything and can be disregarded.

  • Current use
    This is the amount of memory that your VPS is currently using.

RAM pages
In a 32bit environment, ram is always used by 4kb pages. A page is basically a "block". In order to convert something from pages to megabytes, you multiply by 4, then devide by 1024 (to go from kilobytes to megabytes). For example:

65536 * 4 / 1024 = 256

In other words: 65536 (4kb) pages equals 256mb. So if your oomguarpages soft limit is set to 65536, that means you have 256mb guaranteed RAM.


Current use: allocation vs. actual usage
As you can see in the above description, the current use of the privvmpages represents how much RAM your VPS has allocated, and the current use of the oomguarpgaes represents how much RAM is actually being used.

Now you might wonder; what's the difference between allocation and actual usage? Allocation basically means "reservation". For instance when you run a webserver, it might allocate 50mb ram but only use 20mb of that allocation.

Your RAM guarantee applies to the actual usage. For instance if you have 256mb guaranteed RAM, your VPS can safely allocate 400mb if the actual usage is less than 256mb, since the guarantee applies to the actual usage (e.g. it simply doesn't matter how much ram is allocated).


Burstable RAM
By now it should probably be clear what guaranteed RAM is. But what is burstable RAM? Burstable RAM is the memory that's available beyond the guaranteed ram. For instance your VPS might have 256mb guaranteed ram, and 1024mb burstable ram. This means that after you have used up your guaranteed ram, there's still 768mb burstable ram available for burst usage - IF there's enough free memory on the host server.

We always leave some extra memory available in each host server as burstable ram. Additionally extra burstable ram is available if another VPS on the same server doesn't use up all of its guaranteed RAM.

Please do keep in mind that in the event a VPS suddenly needs its guaranteed RAM, that VPS will always get it. As a result, that may also mean that a VPS which is using burstable RAM, may get some processes killed in order to reduce its burstable RAM usage. As such, it is highly recommend to not rely on burstable ram except for peak usage. As a rule of thumb, you should always make sure that your guaranteed RAM covers your typical ram usage. For instance if you typically use 350mb ram, you shouldn't get a VPS with 256mb guaranteed ram, since you'd be using almost 100mb ram which may get killed off. Surely it may work just fine - but your processes are at risk that way.

If you are looking to order a new VPS and you aren't sure how high your memory usage will be, then please contact our sales department and we'll setup an evaluation environment for you, which will allow us to make a recommendation as to how much guaranteed RAM you should get as a minimum.


I hope this was helpful. If you have any questions or if you feel like you need something explained in more details, please let us know and we will provide you with a full explanation.

-----------------
Best Regards,
John Strong
SolidHost Chief Operational Officer
SH-John is offline   Reply With Quote
Old May 17th, 2007, 19:05   #2
robdevos
Customer
 
Join Date: Apr 2007
Posts: 12
Default

The instruction top in SSH gives the following information:

Mem: 1048576k total, 246268k used, 802308k free

Is my VPS using those 246268k memory or are all the VPS"s which share the same server using it?

Rob :-)
robdevos is offline   Reply With Quote
Old May 17th, 2007, 19:17   #3
SH-John
Customer
 
Join Date: Jan 2007
Posts: 51
Default

Hello Rob,

That's a very good question. Until recently when doing the free -m command you would have been presented with the server information. A recent update now means you see your VPS memory. Although it isn't in as much detail as mentioned above, it is easy to understand.

1024 MB Total, including burstable RAM. 241 MB used.

Did that answer your question?

-----------------
Best Regards,
John Strong
SolidHost Chief Operational Officer
SH-John is offline   Reply With Quote
Old May 17th, 2007, 20:01   #4
robdevos
Customer
 
Join Date: Apr 2007
Posts: 12
Default

Yes, that answers my question.
Thanks.

It leads to two other questions.
The amount of memory my VPS uses is always about 240 MB. Why does this change so little? One should expect that sometimes the server is busy and uses a lot of memory and on other moments it doesn't need al that memory.

That 240 MB is almost the guaranteed RAM (256 MB) of my VPS. What can be done to use less memory.

Rob :-)
robdevos is offline   Reply With Quote
Old May 17th, 2007, 20:19   #5
SH-John
Customer
 
Join Date: Jan 2007
Posts: 51
Default

Hello Rob,

Off the top of my head I don't know which control panel you are using, so I can't say for sure.. It can also depend on the content of the website. Some websites can be very busy and use very little memory. Other websites can use a lot of memory when they aren't busy. Usually it has to do with SQL usage or not. Also keep in mind, linux as a whole tends to use what memory it can and not give it back until it's needed. That's just the way linux works.

If you want to try and lower your usage, please open a ticket to support and ask for unused services to be turned off.

If your usage is remaining steady at that, I don't think you have anything to worry about.

-----------------
Best Regards,
John Strong
SolidHost Chief Operational Officer
SH-John is offline   Reply With Quote
Old May 17th, 2007, 22:15   #6
robdevos
Customer
 
Join Date: Apr 2007
Posts: 12
Default

I'm using cPanel.
My website isn't very busy, but most of the pages are dynamic.
Thanks for your answer.

Rob :-)
robdevos is offline   Reply With Quote
Old Mar 23rd, 2010, 07:35   #7
Alexanderjhon
Customer
 
Join Date: Mar 2010
Posts: 10
Default hi

The bulk of anamnesis my VPS uses is consistently about 240 MB. Why does this change so little?
Alexanderjhon is offline   Reply With Quote
Old Mar 23rd, 2010, 07:56   #8
Alexanderjhon
Customer
 
Join Date: Mar 2010
Posts: 10
Default hi

A rather good, concise, and understandable explanation of VPS memory allocation. At least for OpenVZ VPS's
Alexanderjhon is offline   Reply With Quote
Old Mar 23rd, 2010, 21:38   #9
SH-Andre
SolidHost Crew
 
Join Date: Sep 2001
Posts: 850
Default

Quote:
Originally Posted by Alexanderjhon View Post
The bulk of anamnesis my VPS uses is consistently about 240 MB. Why does this change so little?
This depends a bit on the applications you run. Some applications basically reserve memory for future (expected) usage, so they can easily start using it when it's needed.

Some applications will for example reserve 20mb RAM, while they actually only use 10mb. Then when the actual usage stays below 20mb, the numbers you see won't go up or down.

Needless to say - ram guarantees only take actual usage into consideration (so applications won't get killed if they reserve a lot of RAM but don't actually use it).

If you want to see your actual usage parameters, you can use this command:

Code:
cat /proc/user_beancounters
Quote:
Originally Posted by Alexanderjhon
A rather good, concise, and understandable explanation of VPS memory allocation. At least for OpenVZ VPS's
Thanks! It was originally written specifically for Virtuozzo, but it also applies to openVZ (same technology).

-----------------
Andre van Vliet
SolidHost Administrators

Solid as a Rock
SH-Andre is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT +2. The time now is 09:31.