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

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.

share|improve this question

4 Answers 4

up vote 1 down vote accepted

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

share|improve this answer

You've answered your own question. Web servers typically hit RAM limits before CPU. Once you start exhausting RAM, the O/S will start swapping, causing a downward spiral of disk thrashing, with one outcome. If your host is running on Linux, there's a chance the kernel will start killing processes in order to preserve itself. Apache could be one of the first to go.

So, monitor RAM utilisation, and speak nicely to your cloud provider BEFORE you hit problems.

share|improve this answer

Ordered by, "How quickly can I make this change?"

  • Serve only static pages using NGinx.
  • Redirect traffic to a CDN.
  • Procure adequate resources to serve required dynamic pages under load.
share|improve this answer

For CDN take a look at Akamai, Amazon CloudFront, or cloudFlare. Also make sure youre not going to pay exorbitant traffic fees.

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.