I'm deploying a smartphone messaging app, which is served by an architecture that involves an email server, PHP requests, and a MySQL DB. Here are the characteristics of the server architecture:
-Small MySQL database, using InnoDB. Entire database will fit into RAM in a 1GB buffer pool. Simple queries, mostly single table, sometimes 2-table joins. Lots of small SELECTs/INSERTs/DELETEs.
-Data in/out of the database will be small. Each INSERT/SELECT will insert/return just a bit of text.
-Emails in/out will all be fairly small, just a bit of text, sometimes with a <100k image.
-PHP forms only serve to query the database, so they're fairly simple. The web service (Apache/lighttpd/nginx) will only be serving PHP forms; no other web content.
Basically, the DB and email server will see lots of small I/O, spread more or less equally throughout the day.
My setup is the following (LiquidWeb Smart Servers):
Server 1 (already configured)
-Hardware: 2x AMD Opteron 6128 (16 cores total); 16GB RAM; 4x SATA RAID10, total ~1TB
-Software: Exim, with the mail spool on a RAM disk to maximize performance; Dovecot; ASSP Deluxe for antispam; cPanel
Server 2 (haven't purchased/configured yet; there are a couple of options)
-Hardware: 4x AMD Opteron 6128 (16 cores total); 64GB RAM, or 96GB RAM; 2x Crucial RealSSD 256GB in RAID1, or 8x SAS 15K RPM in RAID10, total ~1TB
-Software: Apache, Lighttpd, or Nginx; FastCGI for PHP; MySQL 5.5+; possibly cPanel, or not
Goal is to be able to handle 100+ queries/second, 100+ PHP requests per second, 100K+ emails per day in/out (200K+ total).
Now that I've laid all that background....questions are these:
1) For these needs, is it going to make much of a performance difference to run Lighttpd or Nginx in place of Apache? Replacing Apache with anything else on cPanel sounds like a pain, so if I went this route, I'd probably just not use cPanel at all. Considering all of the above, is it worth ditching Apache and cPanel to get the performance increase of a lightweight web server?
2) On the email server, I'm running Exim with the mail spool on a RAM disk, so it should run very fast. ASSP is not resource intensive at all (much lower usage than SpamAssassin), and Dovecot is also low profile. Am I gaining much by having it on a separate server, or would I be just fine ditching it and putting everything on the more powerful server #2?
I had thought about splitting everything into smaller servers, but I want to keep MySQL and the web service on the same box. The nature of the app means I'll have lots of quick connects/disconnects to the MySQL DB, and I want to keep them localhost in order to be as fast as possible. This leaves me with the email server and the web/DB server, but it looks like server #2 might be fast enough to just handle everything.
Sorry for the wall of text. Any input would be greatly appreciated. Thanks!
Lighttpd will give you a massive performance gain over Apache when serving static files. Several hundred percent, from my personal experience (running a busy entertainment website on a cluster of 5 lighttpd servers).
For PHP, not so much. It should be a bit faster and handle more requests if you configure it right. You should have no problems serving 100+ php req/s if your lighttpd server is well configured, mysql server and queries are well optimized. I had no problems serving 200+ request/s on a medium end machine. Just make sure you set up everything right, especially config variables such as PHP_FCGI_MAX_REQUESTS, PHP_FCGI_CHILDREN, server.max-connections, server.max-fds and so on. Some early benchmarking (apache benchmark should do the job) will help you set everything right.
Do you already need that type of processing power for a new app?
I'll also be running a considerable ad campaign, which will push downloads quite a bit (possibly 20,000 new users in a day).
Originally Posted by NuPagady
Won't be serving any static files, so would it be worth it to run lighttpd? Could I tune Apache to give me the sort of performance that lighty can offer?
Edit: Just saw where you mentioned I can probably handle more requests with a nicely configured lighttpd. I think I'll go that route.
Would there be any benefit to running cPanel, since I'm ditching Apache?
Also, would I see any benefit from going with the dual RAID1 SSDs, as opposed to the 8x RAID10 SAD array? I really shouldn't need to hit the disk much at all, at least not for the database and email queue. And the SSD setup would definitely cost me more...
And much thanks for the info!
Last edited by null_skills; 04-16-2011 at 06:59 PM.