Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

I have a website that has approximately 300 users and I get about 1000 hits per day. Due to an upcoming event next week, there is a possibility of all of a sudden getting between 20 and 25 thousand users per day, with between 60 and 70 thousand hits. I currently have 2 CPU on a semi-dedicated hosting. My host is aware that there could be a bump in users and said that he could quickly up the CPU as needed. However, there's also an option of prepaying for additional CPU. As the 20-25K users would be purchasing access to my site, I definitely want that aspect to go smoothly. Is there anyway to tell whether I should purchase access to the additional CPU?

Additional information:

1) A screen shot of my usage of the last week (the spikes are nightly database/file backups and won't increase with the new users)

2) I use a CDN for images, javascript, css

3) My "purchase access to the site" script takes about 2 seconds to run as it's interacting with my payment processor.

4) Each page that the user accesses requires a check via php to see if they're logged in, and 1-2 trips to the database: typically page loads are under 5 milliseconds.

If I'm being neurotic and shouldn't purchase more CPU, then that's fine for someone to tell me so. However, if this seems like a case where I should make the purchase, it would be great to know what number of additional CPU cores would be appropriate.

share|improve this question
1  
Have you tried benchmarking or load testing the site to see how much traffic it can handle at the moment? Also, are you sure your current page loads are <5 ms? As that is very fast. –  Tim Fountain Mar 21 at 21:20
    
I'm a little bit embarrassed to say that I haven't done load testing; next week's event has caught me a bit off guard. And, when I say the "page loads", I'm referring to the time that php needs to execute: I save every page load time to my database and compute the mean page load nightly, so that I do feel confident about the 5ms figure. (I do lots of caching, use the CDN and my host uses LiteSpeed, which I think speeds things up significantly). –  Eric Mar 21 at 21:28
    
What are your hardware specs? How many other sites are on the server? It may be best to migrate to a dedicated server. I was a webhost in a prior life and I would have moved you to a dedicated server even if it was just for a while. I would have had a responsibility to you and the other sites to do the right thing. –  closetnoc Mar 21 at 23:40
    
There are 14 other sites sharing the server. In terms of hardware specs, it has 5GB disk space, 300GB bandwith, 2 CPU cores (my host said that I could purchase short term use 7-14 days of up to 6 more; if there were still issues, he said we would move to a dedicated server), 50 concurrent MYSQL connections. With all that said, if I did just request 2 or 3 more CPU core, would that be somewhat analogous to having a dedicated server? –  Eric Mar 22 at 0:21

1 Answer 1

up vote 2 down vote accepted

I think the approach here should depend on the nature and timing of the traffic:

  • If you are expecting a curve increase with traffic spread throughout the day then 70000 hits/day works out at just less than 1 hit per second, and with a page processing time of around 5ms this should be no trouble at all.

  • If instead you are expecting a spike increase with the potential of those 70000 hits all within a period of an hour for example, then this works out at around 20 per second, which may or may not be an issue for you depending on a whole variety of things.

When scaling up, increasing CPU will only get you so far in terms of performance, but for capacity you should consider scenarios such as being able to respond to requests simultaneously through the use of load balancing and multiple VPS instances.

If your website can be adapted to work with solutions such as Amazon Web Services or Google Cloud you could simply fire up additional instances or use auto-scaling as required for capacity and just pay as you go for bandwidth/diskspace used etc.

You mentioned using CDN for static resouces, however you could also split your site into two, and use different hosting environments/providers for each:

  • Your main domain www.example.com with the pages that the public see that rarely change, could be hosted either (a) with two or more shared hosting providers, ideally ones that offer generous or unlimited bandwidth, and setup an address (A) DNS record to each host; or (b) on Amazon Web Services, using a stack of S3 for static files, EC2 for your dynamic processing (PHP/ASP etc), RDS for your MySQL databases, ELB for your auto-scaling, CloudFront for CDN/acceleration etc.

  • Your subdomain secure.example.com (perhaps with an SSL certificate?) that needs access to your database for when people are accessing pages tailored for them, eg. login areas, order/payment processing, subscription service areas etc, could be kept on your existing hosting setup. By separating the two you should have more resources available to serve these higher importance requests.

In this way if you had problems with one of the above the other would still work fine. Solutions like this used to cost a fortune and require a lot of expertise but these days it can be accomplished on a minimal budget by one person who is happy to experiment and learn, all the knowledge required can be found in the Amazon or Google documentation, or if you chose to use multiple shared hosts you wouldn't require any additional knowledge (though this may cost more as pricing is typically fixed).

While it can be considered good practice to test how your site copes under pressure with stress testing, you should be very wary of doing this if you do not own the infrastructure and if it is not soley used for operating your website since otherwise it could impact on other customers services, breach the terms of your hosting contract, and leave you liable to prosecution for causing what could be considered a denial-of-service attack by the service provider if they have not authorised it in advance. Instead of stress testing the 'live' hosted environment, try to replicate the setup in a virtual machine on your PC and see how it copes while stress testing it 'offline'.

share|improve this answer
    
Thank you for a very detailed answer! And, you've given me a very definite direction in which to proceed. –  Eric Nov 19 at 20:28

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.