Swap! How much?

Hi,

I'm running vBulletin + vBSeo in a 360 linode with Apache (I know nginx :) ) + MySQL + Php5 + Exim for outgoing only.

My average swap is 30 MB. Is this to much? Is this bad? When should I upgrade?

Thanks

5 Replies

10-15% of available RAM does not see too bad to me…

James

I'd say how much swap you are using is less important than how actively you are using it. Try running $ vmstat 60 and look at the si and so columns - they should tell you when you are actively swapping memory in and out.

If you have 30M going out to swap and staying there then you have no problems - if you are swapping 30M in and out every 5 seconds then you and your neighbors are probably not very happy ;)

Hi,

Thanks for both responses.

Here is vmstat 60:

procs -----------memory---------- ---swap-- -----io---- -system-- ----cpu----
 r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa
 0  0  21504  11628  22748 205496    0    0     1     4   13   14  0  0 99  0
 0  0  21504  10524  22800 205652    0    0     2    13   87  107  0  0 100  0
 0  0  21504   9468  22896 205880    0    0     4    23  151  190  0  0 99  0
 0  0  21520   8376  21432 202232    0    0     2   105  322  329  1  0 98  1
 0  0  21520  38080  21496 202304    0    0     1    21  121  135  0  0 99  0

At this time I have 80 simultaneous users in my forum. At night it can reach 100.

It looks good :)

There's a couple numbers I like to look at on a vmstat:

1) buff + cache: This is about 223MB for you, which is excellent. This is how much memory the kernel is using to store disk-based objects in memory. You can consider this "free" memory – if an application need a lot of RAM suddenly, the kernel can shrink buffers and cache very quickly.

You're probably now wondering "so why am I using any swap at all?!"… the kernel keeps track of how often chunks of memory are used and will choose to swap out rarely-used stuff to have more memory to cache frequently-used stuff.

2) si + so: This is how active it is with swapping. Seeing lots of big numbers here == swap thrashing == bad performance. Anything above about 200 catches my attention, 'tho if you run into true swap thrashing, you'll know it ;-)

3) bi + bo: This is how actively you're reading and writing to disk. Disk I/O is expensive (that is, it takes more time and has a greater impact on performance than, say, memory or CPU operations), so minimizing this is a quick way to eek some more performance out. Your I/O looks great… not too much reading, and writing looks pretty reasonable (you're probably logging web traffic and writing new stuff to your database).

4) The CPU stuff. us, sy, id, and wa add up to roughly 100%. "us" is how much time user tasks (daemons, scripts, sshd, etc) spent doing things; "sy" is how much time the kernel spent doing its things (pushing packets, scheduling tasks, pondering memory allocation, etc). "wa" is how long tasks were waiting for disk I/O -- in other words, if this number gets high, things are slow. "id" is simply 100% minus all those; the idle percentage.

So, yeah, I think you're in great shape. :-) -rt

Well, this is better than Wikipedia :)

Thanks for you excellent explanation :D

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