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.

I'm writing a PHP site that's expected to get about 200-300 concurrent users browsing it. When initializing the application will load about 30 PHP classes, some 10 maybe 15 images and a couple of css files.

So my question is, what else can I do (except optimizing my code and using apc/eaccelerator for PHP) to get as close as possible to those numbers of concurrent users?

Currently we haven't chosen a server for the site to be hosted on but most probably it'll be a VPS Dual core + 2 or maybe 4GB RAM. Is it possible for such a server to handle that load? Also how could I test it myself and be sure that it'll be able to handle it?

share|improve this question

2 Answers 2

up vote 2 down vote accepted

I would personally recommend Apache using mpm_worker with FastCGI PHP, eAccelerator, and possibly disk caching via mod_disk_cache, depending on your PHP application. If you use PHP to generate sttaic, cacheable files like images, JavaScript or CSS, or if your content is cacheable, you may notice a huge performance boost.

We switched from Apache's mpm_prefork + mod_php to mpm_worker, FastCGI PHP and mod_disk_cache, and we saw dramatic improvements in speed. One reason is, we use PHP to minify JS and CSS files, and even just calling PHP to readfile() a cached minified JS file is far slower than letting Apache with mpm_worker serve that file from a disk cache.

Many people tout lighttpd above Apache at all costs saying Apache is bloated and slow. I've used lighttpd before and it was pretty slick, but in my experience Apache can be tuned for extreme performance, and the mpm_worker module gives you the same basic threading concept that lighttpd is based on.

Re: RAM, get as much as you can! If you can afford 4GB, do it. You'll be glad you did.

For performance testing, there's lots of great tools out there but I find that the apacvhe benchmark tool that comes with Apache is a fast and easy way to test for performance. The specifics of how it should be used warrants a separate question :-)

share|improve this answer
    
Thank you for sharing this information! I'll most certainly try adding the suggested modules. Only parts of my php code is cacheable but all of the images/css/javascripts are not changed frequently (or maybe wont be changed for a long time) so I'll give it a shot! I'm sorry I can't give yet points but when I'm able I'll come back and add :) –  tftd Jan 12 '11 at 1:45

Unless your PHP code is really awful, the answer is that any of those solutions should handle the load. You should go with whatever is most familiar to you and the easiest for you to configure and manage.

share|improve this answer
    
Yes I thought that too. I'm influenced by Java and that's why my code is 98% static OOP. And because I'm doing this for the first time in php I wasn't quite sure if this wouldn't brake it. –  tftd Jan 12 '11 at 1:40

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.