What would be a quick fix in case of server downtime due to sudden high traffic?

PMoubed asked:

Let’s consider a scenario like below:

A small web blog build based on LAMP stack and deployed on a shared hosting.
Suddenly it becomes popular in one day and it gets million hits per day.
Since the developer have not consider high traffic, it caused server downtime and crashes.

What would be a quick fix for such a scenario?

BTW I know on cloud Servers I may be able to add more RAM or CPU to avoid that like in Amazon EC2.

My answer:


Don’t get into this situation in the first place.

Shared hosting providers are notorious for having difficulty handling large traffic spikes to a single customer, and since you don’t run the machine, there’s not much you can do to optimize things.

Probably the best you can do on shared hosting is application-level caching. For instance, if you use WordPress, install W3 Total Cache in disk caching mode.

If you realistically expect large amounts of traffic on an ongoing basis, you would do best to move to servers you control as soon as possible. The point at which I would start planning to get off shared hosting is about 5,000 unique visitors/day. By the time you get to 10,000 you should be long gone. (This is just a rule of thumb; your provider may be better or worse.)


View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.