Results 1 to 19 of 19
  1. #1
    Join Date
    May 2005
    Location
    Toronto / New York
    Posts
    166

    No SWAP memory on a VPS?

    When I asked why my managed VPS was configured with no swap, and that it please be configured I was told this by my VPS provider:

    Its not possible to add swap partition on a VPS, and there is no need to create separate swap file. You can keep track of the memory usage in power panel under resource alerts. If the VPS is using up the memory allocated, you can see the alerts there.

    I realize that it's "best" to never start swapping a lot, but my understanding was that if memory was low, some virtual memory would keep you going at least, to avoid services from crashing or worse.

    Thoughts?

  2. #2
    Join Date
    Jan 2011
    Location
    Varna, Bulgaria
    Posts
    1,276
    If it is an OpenVZ VPS there is simply no such thing as swap.
    If it is Xen you can easily add swap yourself.

  3. #3
    Join Date
    May 2005
    Location
    Toronto / New York
    Posts
    166
    Quote Originally Posted by rds100 View Post
    If it is an OpenVZ VPS there is simply no such thing as swap.
    If it is Xen you can easily add swap yourself.
    What about Parallels Virtuozzo?

    I'm coming from a Xen VM, so the information about OpenVZ is new to me. Can someone explain?

  4. #4
    Join Date
    Jan 2011
    Location
    Varna, Bulgaria
    Posts
    1,276
    Virtuozzo is OpenVZ so there is no swap. OpenVZ has "guranteed RAM" and "burst RAM".

  5. #5
    Join Date
    May 2005
    Location
    Toronto / New York
    Posts
    166
    Quote Originally Posted by rds100 View Post
    Virtuozzo is OpenVZ so there is no swap. OpenVZ has "guranteed RAM" and "burst RAM".
    Ok interesting, so if I'm down to 0MB free what will I see on my VM? Will the amount of memory change when it "bursts"? Here is what I'm seeing now in free -m. Also what about the typical "cached" RAM that Linux would reserve, right now I'm seeing none.

    Code:
    [root@host ~]# free -m
                 total       used       free     shared    buffers     cached
    Mem:           768         80        687          0          0          0
    -/+ buffers/cache:         80        687
    Swap:            0          0          0
    Thanks!

  6. #6
    Join Date
    Jan 2011
    Location
    Varna, Bulgaria
    Posts
    1,276
    No, the maximum memory you can burst to is 768MB. How much of that is guranteed cannot be seen this way.
    cat /proc/user_beancounters to see various OpenVZ limits and statistics. And then look at http://wiki.openvz.org/UBC to see what they mean.

    Also there is not cached memory because the VPS doesn't do any caching, it doesn't even have its own kernel. There is only one kernel on the hardware node, and your VPS just has processes isolated in a container. The chaching is done at the hardware node level.

  7. #7
    Join Date
    May 2011
    Location
    N/A
    Posts
    118

    * How can we?

    Quote Originally Posted by rds100 View Post
    If it is an OpenVZ VPS there is simply no such thing as swap.
    If it is Xen you can easily add swap yourself.
    Under Xen how can we add swap?

  8. #8
    Join Date
    Apr 2008
    Location
    United States, MI
    Posts
    769
    Quote Originally Posted by stardust_x7 View Post
    Under Xen how can we add swap?
    Create a partition on your disk and format it to be swap?

    IE: The same way you add swap on all Linux systems.
    Steven Crothers
    No BS cloud engineer and Red Hat architect.

  9. #9
    Join Date
    Apr 2010
    Location
    North Carolina
    Posts
    442
    Quote Originally Posted by stardust_x7 View Post
    Under Xen how can we add swap?
    http://www.cyberciti.biz/faq/linux-a...ap-file-howto/

  10. #10
    Join Date
    Feb 2010
    Location
    Evanston, IL
    Posts
    54
    Most hosts don;t like to offer swap because of the load it generates on the SANs, I/O from alot of random reads and writes.

    If swap is something you really need you can create a swap file, adjust to following to suit your needs:

    1) Create a file to use as swap:
    -this command will create 1GB file
    dd if=/dev/zero of=/swapper bs=1M count=1024

    2) Create a swap are in the file:
    mkswap /swapper

    3) Turn the swap on:
    swapon /swapper

    4) To make the swap area persistent on reboot add the following line to /etc/fstab:

    /swapper swap swap defaults 0 0

    5) Run:

    free -m

    You should now see your available swap space.
    shtuff.it - Popular Linux tools from the browser

    monty@shtuff.it

  11. #11
    Join Date
    Mar 2011
    Location
    florida
    Posts
    158
    Openvz swap file install works perfect
    [root@s1 ~]# free -m
    total used free shared buffers cached
    Mem: 512 325 186 0 0 0
    -/+ buffers/cache: 325 186
    Swap: 1024 0 1024
    [root@s1 ~]#
    i only have 512mb ram
    now i have a swap as seen in root also as seen in webmin running proc
    Display : PID | User | Memory | CPU | Search | Run..

    Real memory: 512 MB total / 186.25 MB free Swap space: 1024 MB total / 1024 MB free
    i dont run outa memory no more
    OpenVZ does not support Swap. If you have a program that requires swap, then you can create and use a fake swap.
    1) Log into your vps as root.
    2) Download fake-swap.sh shell-script.
    wget XXhttpX:X/X/service.welcome2inter.net/downloads/fake-swap.sh
    3) Make script executeable
    chmod u+x fake-swap.sh
    4) Run script to create fake swap ...
    ... with 512MB (default)
    ./fake-swap.sh
    Enjoy



    ... with 1024MB

    ./fake-swap.sh 1024

  12. #12
    Join Date
    Oct 2010
    Posts
    154
    Quote Originally Posted by Dig1 View Post
    Openvz swap file install works perfect
    ...
    i dont run outa memory no more
    The swap is fake. It is used to fool applications so that they think there is swap space available but in actual fact there is none. You will still run out of memory if you use that fake-swap.sh.

  13. #13
    my vps too have the same problem

  14. #14
    Join Date
    Jun 2010
    Location
    Java Island
    Posts
    147
    virtuozzo/openvz vps doesn't support swap, if you need swap for your development move your app to Xen box!
    <<please see forum rules for signature formatting guidelines>>

  15. #15
    Join Date
    Jul 2011
    Posts
    97
    Yes and shared between other boxes too.

    Kind Regards
    .
    .

    Quote Originally Posted by rds100 View Post
    Virtuozzo is OpenVZ so there is no swap. OpenVZ has "guranteed RAM" and "burst RAM".

  16. #16
    Join Date
    Feb 2010
    Location
    East Coast
    Posts
    410
    Honestly the best way to remedy the problem of not enough ram is to upgrade the amount of ram that you have. :/ That is really the best way. Whether you are on OpenVZ or Xen, you NEVER want to start swapping. You are best off just putting up some more dough for the extra bit of ram. Most times it doesnt cost that much.

  17. #17
    Join Date
    Jul 2011
    Posts
    355
    As others have said, OpenVZ does not use swap, that is why you have burst RAM on OpenVZ.

  18. #18
    Join Date
    Mar 2011
    Location
    florida
    Posts
    158

    Clue 4 the Clueless

    As stated on this forum in many articles
    OpenVZ does not use swap!
    OpenVZ does not Support swap!
    OpenVZ is designed to use Burst Ram!
    If you really need Swap Migrate to XEN!
    Or buy more Ram if using OpenVZ!

  19. #19
    Join Date
    Oct 2009
    Posts
    590
    Well I guess I may as well break the bad news to you all and muddy the waters. OpenVZ does now support swap with their new RHEL6 kernel that recently went into the stable branch.

    It's not the same as real swap which is why they call it "vswap" but from inside the container it looks exactly the same. Oh and memory caching is now supported too. So now all memory inside a container behaves exactly the same as on dedicated hardware. Thankfully these new features supersede burst memory which was confusing to a lot of people and not useful for anything anyways.
    http://wiki.openvz.org/VSwap

    In my limited testing so far it seems to work well. It seems to have tamed Java behaviour which was an annoying problem with the old memory management model.
    Last edited by UnfinishedSentenc; 09-08-2011 at 05:20 PM.

Similar Threads

  1. Swap memory/Physical Memory
    By twinmom in forum Dedicated Server
    Replies: 8
    Last Post: 03-22-2011, 08:23 PM
  2. Replies: 0
    Last Post: 11-23-2010, 08:18 AM
  3. Swap memory on Xen VPS
    By lovelycesar in forum VPS Hosting
    Replies: 13
    Last Post: 11-13-2010, 07:58 AM
  4. Replies: 4
    Last Post: 10-02-2010, 05:07 PM
  5. Replies: 0
    Last Post: 10-02-2010, 04:34 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •