Swap space

Is the recommended 64 MB Swap enough for a basic Linode (Redhat 9 large)?

3 Replies

@fredz:

Is the recommended 64 MB Swap enough for a basic Linode (Redhat 9 large)?

It depends upon what you are using your Linode for. But as a general rule, I would say 'no'. I use 320 MB for my swap, and after a week of running Apache + Courier IMAP + qmail (as my most active processes), I am currently using 56 MB of swap and 20 MB of RAM.

I think that you could pretty safely get away with 256 MB of swap, and maybe even 128 MB. But 64 MB seems just way too small to me. This would give you only 128 MB of virtual memory, and if your processes ever need more than this at one time, you are going to have alot of trouble. And 128 MB of memory doesn't sound like alot in this day and age, when notebook computers regularly come with 256 MB plus.

Running an eggdrop, vnc and a couple of mozilla windows uses up all 64mb RAM and about 40mb swap space. Even with more windows open I haven't seen it go above 64mb swap space, so you may just about be ok depending on what you use it for. I'd still stay on the safe side if I were you and go for 128mb swap just in case.

This is RH large btw.

I think if you are actually using 256M of swap, then you need to get some more RAM in a hurry! I myself created a 128 Meg swap partition - that gives me a minimum 2:1 swap ratio, and if I upgrade to 128M Ram, it'll still at least be 1:1.

How much swap you need must depend on what applications you are running and how - for example, if you are running an X server, and only rarely need to connect to the X server to do some administration, then it is most likely fine if it gets swapped out at other times. However, if you are actively serving a lot of dynamic pages, then if your apache processes start getting swapped out, the server is probably going to slow down in a hurry.

The above paragraph is pretty subjective, however, and I would be interested in getting some measurements to help out in this area. Right now, my server (with 64M RAM, and 128M Swap) is reporting 59M Mem used, and 65M Swap used. This is with Apache, Mysql, Postfix/Courier, and a web application server running. What I would like to be able to determine, is - what processes are getting swapped out, how often is this happening, and is this a problem?

Aside from ps and top, I found a few other tools, such as sysstat (sar, sadc), vmstat, and free. However, I don't really have a handle on what these tools are telling me. For example, sar -W reports the total number of swap pages the system brought in per second - right now in the early morning I am seeing averages of 2/sec, and when the cron dailies kicked in, that number was around 17. Is this acceptable? If so, what levels would be problematic? With a large number of VMs per system, it would seem to me that disk access could easily become the bottleneck in the system, so avoiding a lot of swapping would be desirable.

Can anyone who's had experience tuning servers add to my conjecture with some hard info?

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct