Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > Linux Forums > HOWTO-Related Questions

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Reply
 
Thread Tools Display Modes
  #1  
Old 31st March 2013, 21:58
darinpeterson darinpeterson is offline
HowtoForge Supporter
 
Join Date: Nov 2011
Posts: 153
Thanks: 35
Thanked 13 Times in 13 Posts
Question OpenVZ VSwap Memory Is it RAM or Hard Disk

Hi,

I'm currently working with CentOS 6.4, and installing multiple virtual servers. The VSwap implementation is a little confusing to me. Does the swapping of VSwap happen in RAM or on the hard disk?

If it's on the RAM, then I should configure my memory not to over run the hardware amount available, right?

Thank you,
Darin
Reply With Quote
Sponsored Links
  #2  
Old 31st March 2013, 22:31
MaddinXx MaddinXx is offline
Senior Member
 
Join Date: Jul 2011
Location: Switzerland
Posts: 197
Thanks: 25
Thanked 60 Times in 44 Posts
Default

Hi Darin

Lastly there was a discussion about that in the OpenVZ IRC channel and here's what I've picked up from it:

- OpenVZ vSwap is not like normal swap
- therefor it doesn't depend on the HW node swap size

but it is:

- happing in normal RAM
- like RAM allocation, but highly slowed down (so it's like swap from speed etc.)

Therefor yes, RAM + vSWAP of all containers should not be higher than total amount of memory (= totally no overselling).

However, always all RAM is used by all containers if needed and only limited if resources are busy. Same seems to apply for vSWAP - since it's located in memory, it cannot be used if all other containers use the total amount of their allocated RAM (if it fills HW total).

Don't take this as carved in stone - but I'm 90% sure I didn't get it that wrong

Hope this helps
__________________
Rackster Internet Services's presences:
Official | Open Source | Github | Facebook | Twitter
Reply With Quote
The Following User Says Thank You to MaddinXx For This Useful Post:
darinpeterson (31st March 2013)
  #3  
Old 31st March 2013, 22:37
darinpeterson darinpeterson is offline
HowtoForge Supporter
 
Join Date: Nov 2011
Posts: 153
Thanks: 35
Thanked 13 Times in 13 Posts
Default

Thank you Michel...

So that begs the question, "why would I use VSwap at all instead of allocating the memory that I want to use for that container?" I don't want the operation to be slow...

It seems I would be better off instead of doing:

6144 Memory
2048 VSwap

to do

8192 Memory
0 VSwap

Don't you think so?

Thanks,
Darin
Reply With Quote
  #4  
Old 31st March 2013, 23:03
MaddinXx MaddinXx is offline
Senior Member
 
Join Date: Jul 2011
Location: Switzerland
Posts: 197
Thanks: 25
Thanked 60 Times in 44 Posts
Default

This is pure speculation now, but what comes to mind:

- some apps require swap, otherwise they won't install (but this will not be the reason for implementing it)
- commercial aspect - doesn't it sound good if you get RAM + vSWAP rather than just RAM (must not be, but I think this could be since a lot of commercial vendors are "leading" the projects direction (Parallels))

But what about:

You have a total of 2GB Ram and create 2 VEs. Each gets 1GB Ram = no problems (but most hosting providers do oversell - it's only for them)

You give 1 VE 1GB and the other gets 1.5GB. Well, what happens if all memory is busy? e.g. 2.5GB RAM (500MB that is not available). It will lead to problems and I if the 1.5GB needs 1.5GB before the other, the 1st VE will only get 500MB.

But if you give 1GB each and 500MB swap for the 2nd VE - both will have the same amount if memory is full (swap will be ignored (that's what I'm not sure about, but as said, I thought it is like that). You won't have problems that way. However, if the one without swap only takes 500MB the 2nd one will have 1GB Ram + 500 swap.
__________________
Rackster Internet Services's presences:
Official | Open Source | Github | Facebook | Twitter
Reply With Quote
The Following User Says Thank You to MaddinXx For This Useful Post:
darinpeterson (1st April 2013)
  #5  
Old 1st April 2013, 00:22
darinpeterson darinpeterson is offline
HowtoForge Supporter
 
Join Date: Nov 2011
Posts: 153
Thanks: 35
Thanked 13 Times in 13 Posts
Default

Yeah, i don't know. I just don't know enough about VSwap, but you're probably right, it's better to have some. I'm going to dig into it, and see what else I can learn as soon as I finish server configurations. Then I'll do some fine tuning.
Reply With Quote
  #6  
Old 8th April 2013, 20:14
darinpeterson darinpeterson is offline
HowtoForge Supporter
 
Join Date: Nov 2011
Posts: 153
Thanks: 35
Thanked 13 Times in 13 Posts
Arrow Might want to dig deeper on this.

Quote:
Originally Posted by MaddinXx View Post
Hi Darin
Therefor yes, RAM + vSWAP of all containers should not be higher than total amount of memory (= totally no overselling).
You may want to look a little deeper on this. After a response from Falko on this thread: http://www.howtoforge.com/forums/showthread.php?t=61272

And after using vzsplit, I found that RAM + vSWAP != TOTAL MEMORY

It looks to me like VSwap may be sharing the swap space between containers. If this is not the case, the only other conclusion I can come up with is that vspilt is very broken.

You can simply run the command on your hardware node, and see that the sum of just the VSwap memory exceeds the RAM in the system.
Reply With Quote
The Following User Says Thank You to darinpeterson For This Useful Post:
MaddinXx (8th April 2013)
  #7  
Old 8th April 2013, 20:30
MaddinXx MaddinXx is offline
Senior Member
 
Join Date: Jul 2011
Location: Switzerland
Posts: 197
Thanks: 25
Thanked 60 Times in 44 Posts
Default

Hi Darin

I'm sure you've seen this as well: http://openvz.org/VSwap but I noted these sentences:

"The sum of physpages.limit and swappages.limit limits the maximum amount of allocated memory which can be used by a container. When physpages limit is reached, memory pages belonging to the container are pushed out to so called virtual swap (vswap). The difference between normal swap and vswap is that with vswap no actual disk I/O usually occurs. Instead, a container is artificially slowed down, to emulate the effect of the real swapping. Actual swap out occurs only if there is a global memory shortage on the system."

"no actual disk I/O" -> it's in memory. And "Actual swap out occurs only if there is a global memory shortage on the system" let me still think that it actually is/should be = total memory amount...

hmm...we have something to kill hours with hehe
__________________
Rackster Internet Services's presences:
Official | Open Source | Github | Facebook | Twitter
Reply With Quote
The Following User Says Thank You to MaddinXx For This Useful Post:
darinpeterson (9th April 2013)
  #8  
Old 9th April 2013, 02:00
darinpeterson darinpeterson is offline
HowtoForge Supporter
 
Join Date: Nov 2011
Posts: 153
Thanks: 35
Thanked 13 Times in 13 Posts
 
Default

Hi MaddinXx,

I did not read that yet, but I'm going to spend some time looking through it. Thanks for your reply.

Here is the result of running vzsplit on my hardware node, which has 32GB ram and 1.3TB disk space:

Code:
[root@hw ~]# vzsplit
Enter the number of containers: 5
The optimal swap space size is 64074 Mb, twice bigger than the RAM size

# Configuration file generated by vzsplit for 5 containers
# on HN with total amount of physical memory 32037 Mb,
# low memory 32037 Mb, swap size 95999 Mb, max threads 16000.
# Resource commit level 0:
# Free resource distribution. Any parameters may be increased

# This is VSwap-enabled configuration
# NOTE this configuration needs OpenVZ kernel 042stab042 or newer!

PHYSPAGES="0:4920936"
SWAPPAGES="0:9841872"

KMEMSIZE="unlimited"
DCACHESIZE="unlimited"
LOCKEDPAGES="unlimited"
PRIVVMPAGES="unlimited"
SHMPAGES="unlimited"
NUMPROC="unlimited"
VMGUARPAGES="0:unlimited"
OOMGUARPAGES="0:unlimited"
NUMTCPSOCK="unlimited"
NUMFLOCK="unlimited"
NUMPTY="unlimited"
NUMSIGINFO="unlimited"
TCPSNDBUF="unlimited"
TCPRCVBUF="unlimited"
OTHERSOCKBUF="unlimited"
DGRAMRCVBUF="unlimited"
NUMOTHERSOCK="unlimited"
NUMFILE="unlimited"
NUMIPTENT="unlimited"

DISKSPACE="105109876:115620864"
DISKINODES="6726221:7398844"                                                                         
CPUUNITS="1000"
That's some food for thought.

Darin
Reply With Quote
Reply

Bookmarks

Tags
openvz, openvz install

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Need some Hints to "The Perfect Server - Debian Lenny (Debian 5.0) [ISPConfig 3]" wahid HOWTO-Related Questions 10 25th August 2010 15:18
Adding non-RAID backup disk to system with RAID 1... BorderAmigos Installation/Configuration 1 20th February 2010 20:50
Accessing Devices from Inside VPS i need help! swap-as Installation/Configuration 2 8th May 2009 14:45
chgrp error new user DKA General 15 28th July 2008 17:45
Adding a second hard disk fobicodam Installation/Configuration 5 21st September 2006 14:00


All times are GMT +2. The time now is 06:51.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.