Howdy, Stranger!

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


The Swap Thing
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.

The Swap Thing

Some providers, provide swap for their VPS Product. Some others don't. As far as I know, Swap is taken from the disk space, it's not something expensive as RAM, and it's taken from client Space Anyway. Basically Provider has nothing to lose. Why would they disable swap ? apart from the obvious reason ($$$)

And what's the ideal size of swap ? is it 1 : 1 with RAM. Or the bigger the better.

Most provider I see provide 1 : 1, RAM : SWAP, but I have 1 eur VPS in Aruba, and it has 1 GB RAM, 2GB SWAP.

So which one is better ?

Thanked by 1saf31

Comments

  • jarjar Patron Provider, Top Host, Veteran
    edited June 2017

    Wears out drives faster and degrades node performance.

    Thanked by 1dwtbf
  • @jarland said:
    Wears out drives faster and degrades node performance.

    My Provider ask me how much swap I need. What should I say ? Should I go for BIG SWAP, or 1 : 1 with my RAM ? e.g. 256 SWAP for 256 RAM

  • jarjar Patron Provider, Top Host, Veteran

    @yokowasis said:

    @jarland said:
    Wears out drives faster and degrades node performance.

    My Provider ask me how much swap I need. What should I say ? Should I go for BIG SWAP, or 1 : 1 with my RAM ? e.g. 256 SWAP for 256 RAM

    I'd go with 256MB personally. Ideally you shouldn't be expecting to use it as anything but a cache.

    Thanked by 1vimalware
  • SplitIceSplitIce Member, Host Rep

    Providers would generally prefer you didn't use any swap on SSD nodes. It can be ideal to have at-least a little bit of swap for those useless processes that collect on running servers.

  • jarjar Patron Provider, Top Host, Veteran

    Also for good measure: swap on KVM is disk. Swap on OpenVZ is RAM pretending to be disk.

  • @jarland said:
    Also for good measure: swap on KVM is disk. Swap on OpenVZ is RAM pretending to be disk.

    So, SWAP on OpenVZ has higher performance than Swap ON KVM ? I have Openvz VPS with 768MB RAM. Should I ask for 768 Swap or Go For 2GB Swap. Since its basically swap with the speed of RAM.

  • jarjar Patron Provider, Top Host, Veteran

    yokowasis said: So, SWAP on OpenVZ has higher performance than Swap ON KVM ? I have Openvz VPS with 768MB RAM. Should I ask for 768 Swap or Go For 2GB Swap. Since its basically swap with the speed of RAM.

    Possibly, possibly not. The OpenVZ kernel artificially slows down memory used as swap to simulate the performance loss equivalent to using disk as RAM. The only reason it uses RAM is so that you entering swap does not negatively impact the health of the drives as well as the performance of other customers on the node.

  • Now, I am confused. I will just go with 768 SWAP for 768 RAM. Thanks.

  • FalzoFalzo Member
    edited June 2017

    if your vps needs to use 768 MB SWAP you most probably got other problems than needing more of it.

    also if there is no swap or you want more you could create an image file on your disk and make it swap https://www.digitalocean.com/community/tutorials/how-to-add-swap-space-on-ubuntu-16-04

  • @jarland said:
    The OpenVZ kernel artificially slows down memory used as swap to simulate the performance loss equivalent to using disk as RAM.

    Does anybody have any idea why they do this? Why in the world would you purposely slow down RAM? It's not like there is going to be an application which specifically relies on swap being slow. Swapping is even transparent to most applications?

  • Actually at the current time, my VPS not needed the swap. It runs fine currently at 768MB RAM 0 Swap. It only host 1 wordpress website. I am asking this, in case in the future I need some swap. And because the provider asked me how much Swap do I need.

    And no, you actually can not add the SWAP yourself.

    @Falzo said:
    if your vps needs to use 768 MB SWAP you most probably got other problems than needing more of it.

    also if there is no swap or you want more you could create an image file on your disk and make it swap https://www.digitalocean.com/community/tutorials/how-to-add-swap-space-on-ubuntu-16-04

  • AnthonySmithAnthonySmith Member, Patron Provider
  • FalzoFalzo Member

    @yokowasis said:

    And no, you actually can not add the SWAP yourself.

    @Falzo said:
    also if there is no swap or you want more you could create an image file on your disk and make it swap

    ah... forgot about openvz limitations... not using that old crap anymore ;-)

    as said before you should be fine with some swap at all, so that there is the possibility for the system to use it. but imho it doesn't make much difference if it is more or less...

  • @Someone said:

    @nulldev said:

    @jarland said:
    The OpenVZ kernel artificially slows down memory used as swap to simulate the performance loss equivalent to using disk as RAM.

    Does anybody have any idea why they do this? Why in the world would you purposely slow down RAM? It's not like there is going to be an application which specifically relies on swap being slow. Swapping is even transparent to most applications?

    ...

    Am I missing something obvious?

  • @jarland said:

    I'd go with 256MB personally. Ideally you shouldn't be expecting to use it as anything but a cache.

    THIS. Listen to Jar. I use 256M everywhere.
    Just the bare minimum for weird apps that demand swap to be present for whatever reason .(yes, they're out there)

  • raindog308raindog308 Administrator, Veteran

    You know, the movie really wasn't as good as the comics, though I wasn't a big fan. But it did have Adrienne Barbeau who I like, and a friend of mine had a big crush on her but that's only because she's busty and he was like that. Anyway, I thought the monster's suit - ok, ok, he's not a monster but come on, he's a monster - was a bit fake and...

    Oh. Swap. Not Swamp. Sorry.

    image

  • jarjar Patron Provider, Top Host, Veteran

    @nulldev said:

    @jarland said:
    The OpenVZ kernel artificially slows down memory used as swap to simulate the performance loss equivalent to using disk as RAM.

    Does anybody have any idea why they do this? Why in the world would you purposely slow down RAM? It's not like there is going to be an application which specifically relies on swap being slow. Swapping is even transparent to most applications?

    The performance penalty is part of swapping. There should always be a penalty for not purchasing enough memory for your applications, but the penalty should be for you and not for neighboring containers.

    Thanked by 2vimalware akb
  • nulldevnulldev Member
    edited June 2017

    @jarland said:

    @nulldev said:

    @jarland said:
    The OpenVZ kernel artificially slows down memory used as swap to simulate the performance loss equivalent to using disk as RAM.

    Does anybody have any idea why they do this? Why in the world would you purposely slow down RAM? It's not like there is going to be an application which specifically relies on swap being slow. Swapping is even transparent to most applications?

    The performance penalty is part of swapping. There should always be a penalty for not purchasing enough memory for your applications, but the penalty should be for you and not for neighboring containers.

    Hopefully I don't drive this thread too off course...

    I run OpenVZ on one of my dedis. So if containers sometimes need to burst over their RAM/physpages limit should I increase the RAM/physpages limit or should I increase the swap/swappages limit?

    If I increase the swappages limit, containers will become slow when bursting. If I increase the physpages limit, containers will remain fast when bursting. In both cases, the entire server will slow down if many containers burst at the same time and the entire server starts swapping.

    So if I am understanding all this correctly, in private OpenVZ deployments, increase physpages if I want containers to be able to burst. If I am selling VPSes, I increase swappages if I want containers to be able to burst. Am I interpreting this correctly? Because then this make a lot more sense.

  • jarjar Patron Provider, Top Host, Veteran
    edited June 2017

    nulldev said: So if I am understanding all this correctly, in private OpenVZ deployments, increase physpages if I want containers to be able to burst. If I am selling VPSes, I increase swappages if I want containers to be able to burst. Am I interpreting this correctly? Because then this make a lot more sense.

    Yeah I'd say you're on the right train of thought there. For your purpose, add minimal swap (256MB) just because some apps will take more memory than they will memory + swap, if no swap is available. I have no idea why, but it's observably true. Then make sure to add more memory if you need more, rather than adding more swap. Like you said, no benefit to you in using more swap than memory if both actually use memory and swap is artificially slowed.

    But if you were reselling, you wouldn't want to sacrifice your node's memory as swap purely because customers didn't want to purchase the amount of memory they actually need. It would effectively be discounting node memory for no purpose that benefits you (or customers, since success is mutual).

    Thanked by 1nulldev
  • @yokowasis said:
    Why would they disable swap ?

    Because you can setup a swap file if you really want or need swap. A swap files is not as performant, but it doesn't tie up disk space either.

    And what's the ideal size of swap ? is it 1 : 1 with RAM. Or the bigger the better.

    Definitely not 1:1. 1/2 of RAM or 8GB, whichever is smaller, but I generally go with something like 1/2 of RAM or 1-2GBs for VMs. It depends on what kind of safety margin I want on the box.

    Swap is just a safety measure at this point, and it shouldn't be relied on.

Sign In or Register to comment.