Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Swap or No Swap?
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

Swap or No Swap?

CltcamCltcam Member

When ordering a VPS, what would be the difference between a VPS with 512MB of ram, and 512MB of swap, vs a VPS with just 1024MB of ram and no swap? Which would you prefer and why? What's the benefits for each?

Comments

  • wychwych Member

    Google is your friend.

  • The benifit of swap is you can get more usable ram . If you have a VPS with 1 GB ram/swap then If your Ram get 1 gb then it will also use swap . It will help you to use more ram. Swap is only available for OpenVZ . Therefore i suggest you to buy a vps with swap

  • Swap is not only available for OpenVZ.

  • @alexpole said:
    Swap is only available for OpenVZ .

    Are you sure?

  • IceCream said: Swap is not only available for OpenVZ.

    What? The concept of Swap existed way before OpenVZ was possible. OpenVZ didn't even allow Swap until recent times.

    said: Which would you prefer and why?

    Simple, you want RAM, you do not want to even need to Swap. Swap is OK to use, but never depend on it.

    http://wiki.answers.com/Q/What_is_difference_between_swap_and_ram

    Thanked by 1Jeffrey
  • wojonswojons Member

    If your swap is ssd then you should use it if its hdd then you need to know your application. i always set my swapiness to 1. this makes it so linux wont swap unless it absoultly has to.

  • wojons said: If your swap is ssd

    Please no, Swapping on a SSD will kill it.

  • Swap or vSwap, which one are you talking about?

  • jarjar Patron Provider, Top Host, Veteran

    Linux was built to have swap, don't skip it or you'll just pay for it out of your ram. Swap is a good place to send things at times, and many applications expect it.

  • wojonswojons Member

    @Silvenga said:
    Please no, Swapping on a SSD will kill it.

    with swapiness=1 and a big node you almsot never swap. so keep ur cool.

  • BinaryLaneBinaryLane Member, Host Rep

    A VPS with 1024mb memory and no swap, is far better than 512mb memory + 512mb swap.

  • jarjar Patron Provider, Top Host, Veteran
    edited July 2014

    @BinaryLane said:
    A VPS with 1024mb memory and no swap, is far better than 512mb memory + 512mb swap.

    ^ Has never used Java on OpenVZ without swap...

    Thanked by 1Makenai
  • BinaryLaneBinaryLane Member, Host Rep

    @Jar I can add 512+512 though.

  • jarjar Patron Provider, Top Host, Veteran
    edited July 2014

    @BinaryLane said:
    Jar I can add 512+512 though.

    And yet you still know so little about memory management apparently. I can show you a 1GB VPS running the same applications as a 512MB VPS with less free memory and no swap to fall back on but hey...you can add two numbers....congrats.

    Over the years I've run into many common applications that will consume more memory when there is no swap available than they would consume memory+swap when swap is available.

  • The issue with swap is that most of the time it is way to slow to work with, compared to the speed of the RAM. Lets say you have a 1 GB RAM VPS, 1 GB of swap, with a non-tweaked non-cached standard wordpress/apache/mysql and get hit by bingbot or go on TV with your stupid website. There are two possible things that can happen:

    • With swap or swapiness on 60 or so:
      Your VPS get's so slow, has 200 FIN_WAIT connections and either mysql or httpd are rampaging your RAM. You run out of RAM and go swapping. You produce so much IO your VPS stops working and your provider kills the VPS because of IO issues. You reboot and it is fixed.

    • Without swap or swappiness on 1:
      Your VPS get's so slow, has 200 FIN_WAIT connections and either mysql or httpd are rampaging your RAM. Both of them get killed by the linux oom and your ram usage is back to normal, but either mysql broke or httpd is not running. Your init system might help you here by restarting them, but most of the time it is just broken, you have a rouge mysql process running or whatever the oom result is.

    Both situations are not what you want, but the first one is, in my experience, less harmfull. I've seen many websites / servers get mysql issues because it just got killed without a nice shutdown.

  • So what would you guys prefer, a 512 MB VPS or a VPS with 256 MB ram and 256 Swap?

  • jarjar Patron Provider, Top Host, Veteran

    @Cltcam said:
    So what would you guys prefer, a 512 MB VPS or a VPS with 256 MB ram and 256 Swap?

    Depends on the software you will be using. If uncertain how your applications respond in a no swap environment in comparison to one with swap, the 256MB is at least the more "normal" environment.

  • Having swap is a good idea; when your RAM is completely utilized, at least the application has something to lean on.

    I'd set it to only use swap when it is really necessary.

  • Cltcam said: So what would you guys prefer, a 512 MB VPS or a VPS with 256 MB ram and 256 Swap?

    512 MB of course. Then make a swapfile to keep everything happy :)

  • @sleddog said:
    512 MB of course. Then make a swapfile to keep everything happy :)

    True that, hah. ;P

Sign In or Register to comment.