Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I find this an interesting, common, conceptual misunderstanding.

When somebody asks this question, he always thinks this way:

- I have a system "A" with x GB of ram, with y GB of swap. - I have a system "B" with x+y GB of ram, and no swap, because it has all the virtual memory A is using.

well, the problem is that one should not compare system B with system A, he should compare system B with system C:

- I have a system "C", with x+y GB of ram, and z of swap.

system C will perform potentially better than B.

The generic explanation is that the kernel may decide that it's better to swap out some data, and use the space for caching purposes. This is a concept, that within limits, it's not related to the amount of RAM.



As long as 'z' is not proportional to x or y that might be fine. If you consider 'z' as a percentage of your RAM then you'll notice that your expensive server with lots of RAM is way slower than a cheap one with small RAM and smaller swap, just because it takes less time for the kernel to fill the swap and finally kill the offending process.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: