Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm running a webserver and database server on the same AWS EC2 instance. I know it's a bad idea to have swap for web server, so should I just turn it off? Will it affect the database service (I guess not but I'm not sure on this). If yes, how do I turn it off?

I'm running Amazon Linux AMI.

Thanks ;-).

share|improve this question
Can you share where you read that /swap is not required? I know that some AMIs have /swap disabled. E.g. the alestic ones used to come with swap disabled. I never understood the reason. – Till Oct 31 '10 at 19:34

No. No. No. No. No.

Also, this is wrong information that you have:

I know it's a bad idea to have swap for web server

share|improve this answer
+1 (I wish i could upvote this more). Never turn off swap, It's there for a reason, and the OS is better at managing it than you are. – Tom O'Connor Oct 25 '10 at 16:30
I remember reading this thing about swap somewhere, couldn't find it. Here's something similar: – Xuki Oct 25 '10 at 17:01
Did you read the actual link? It says to minimize swapping (which is great advice). If your system needed to swap, and you had turned it off, you've got a mess on your hands. It's like realizing "You shouldn't drive off the road" and then removing the guardrails. – mfinni Oct 25 '10 at 17:35
Rather than berating the questioner I suggest giving him an explanation so he understands what is happening. – Mark Wagner Oct 25 '10 at 19:01
Absent a cogent argument or supporting information, this is simply argument by authority. A good answer would describe the tradeoffs and what the poster could do to determine whether this is appropriate. – Chris Adams Dec 18 '14 at 20:32

In general, no, you should not disable swap even if you have plenty of RAM. Having swap can improve system performance because the contents of little-used memory can be copied to swap and then the memory can be reallocated to do something useful.

However, sometimes there are odd circumstances. Where did you get the information that it is bad idea to have swap for web server?

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.