views:

165

answers:

4

Hi,

Is there a standard solution to scale up a website which runs on PHP + Apache web server ? As in I get a traffic of about 100,000 requests/day as of now. 6 months down the line I expect it to grow to 200,000 requests/day. The first cut solution which comes to my mind is deploying more Apache web servers with mod_php, but something seems so wrong about it.

Any ideas ?

+1  A: 

20.000 requests / day is only one every fifth second, sounds like one box should be able to deal with that just fine? If not I'd first have a look at bottlenecks in your code. Redundant database calls? Double-looping database calls rather than simple joins? Are you caching anything?

How to scale after this is totally dependent on your application, how/where do you keep session state and so forth, general advice has limited applicability.

Alexander Sagen
The expected traffic is 100,000 to 200,000. My bad - sorry guys. So - any ideas about the new numbers ?
Amit Sharma
@sagen 200,000 is a request every 2.3 seconds, but that's irrelevant. You'll find the requests aren't spread evenly throughout the day.
Ben Rowe
+2  A: 

i don't have any experience with scaling realy large websites, but i don't think you'll need so scale to different servers in this case. i have a browsergame with 40.000-60.000 requests per day, some cronjobs doing a lot of stuff every 5 minutes and a teamspeak-server on a small server (40 $ / month) and havn't got any performance problems till now.

oezi
A: 

if you like it then you should have put a cache on it

Ryan Guest
+3  A: 

Try these two options first before adding new servers. They may allow you to stick with one server, but your results may vary.

For speeding the site up when you are hit with many concurrent users, look into installing the APC PECL extension (http://us2.php.net/manual/en/book.apc.php). APC will allow you to cache the compiled version of your scripts, saving the step of the PHP interpreter running each time a script is executed.

Also, if you are experiencing heavy load on the database server, look into installing memcached and caching database results for a certain time period, if possible (http://us2.php.net/manual/en/book.memcache.php).

Finally, if you do decide to get a separate server, look into possibly getting a dedicated SQL box. This, of course, assumes that your application is a database heavy application, as web apps are these days. Segregating SQL into a separate box allows it to take advantage of all of the resources on that box, with more cache and processing power. It could be the way to go.

Dan D.
The expected traffic is 100,000 to 200,000. My bad - sorry guys. So - any ideas about the new numbers ?
Amit Sharma