Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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
1  
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

2 Answers 2

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
3  
+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: modperlbook.org/html/5-11-2-Swapping-Prevention.html –  Xuki Oct 25 '10 at 17:01
1  
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
2  
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 2 days ago

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

 
discard

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.