Web-server – Should I turn off swap on AWS EC2

amazon ec2amazon-web-servicesdatabaseswapweb-server

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 ;-).

Best Answer

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?

Related Topic