Choosing Your Server: Web Servers
January 4, 2008 by Kevin Landreth, Technology in Servers and Solutions, Tech Stuff, Tips and Tricks
With Web2.0 upon us, some customers have difficulty deciding when the time is right to make a new server purchase, particularly amidst a sea of buzz words like AJAX, Ruby, and Content Delivery Network. Which server is best for you? Should you get the Celeron or the Dual Clovertown? How can you choose between them without being bitten by over- or under-purchasing? How many times have you purchased a server with your boss looking over your shoulder? Hopefully, I can share a little of my professional experience to make your next server-buying experience a little easier … maybe when your boss is hounding you about how much you are spending on your next server, you can point to this definitive guide from someone who has done a few tours of duty in the industry.
What’s Your Server’s Application?
It’s a simple and straightforward question: What is your server’s application? I’m not talking about whether you are using apache, fastcgi, php, python, lighttpd, IIS6/7, asp or .NET. I am interested in how your server is configured and its purpose: Is it a Combo (http+db), a Workhorse (http or appserver), a File Server (http, ftp, rsync), or a Media Server (http site + files)?
While I boiled down the general “web servers” category into only those few types, I can almost guarantee that your web server will fall into one of them, and each type has its own needs.
The Combo (http+db)
While this is one of the most inefficient configurations, it happens to be the most common. Combo boxes rely heavily on CPU and RAM because they not only process the web request, but also handle the database queries. Databases queries eat up RAM and so do most web-scripting languages. The server’s CPU and hard disk access will probably be the most limiting factors in this type of application. I wouldn’t recommend spending a lot of money on RAID configurations or extra disks in a Combo machine since you would be better suited to run two purpose-customized non-RAID machines — with money to spare on backup space — for about the same price.
When you are able to break your Combo server down into separate dedicated http and database machines, you will be able to better tune and customize each server’s configuration for most efficient disk patterns, VM subsystem pressure and RAM usage. It may sound a little confusing, but I’ll explain a bit more about the different types of servers’ needs in my next post.
The WorkHorse (http or appserver)
When you don’t have a database on your http or appserver, you are looking at more of a workhorse-style server application. This configuration typically needs a focus on RAM and CPU without much demand for disk access. Typically, you will see servers like this bundled with Tomcat or ColdFusion. Most PHP applications suggest this setup because the ever-growing intensity of database queries and the amount of post processing in the scripting languages can put a strain on a box serving both the http and database requests. As a note, when you’ve set up your dedicated http or appserver box, you’ll have to decide whether to use mysql_connect() or mysql_pconnect() for your web application. A word to the wise: pconnect() is great if used in the right circumstances so don’t write it off if you don’t know how to use it or because it crashed your server last summer while you were on vacation. *wink*
The File Server (http, ftp, rsync)
File servers are the easiest beasts to set up. RAID and RAM!! RAM is for the file cache (which prevents direct disk-read requests), and RAID configurations accommodate multiple spindle heads. You will need 4 or 5 disks to make up for the RAID5 “write penalty.” I’d advise you not to get duped by reading about RAID1’s performance in reading from multiple disks. While it may be “smart” by definition, most hardware RAID controllers do not run “smart” RAID1. Don’t neglect the CPU on these toys since CPU plays an important role in bus transfers between the RAM, your disk controller and network connections. Dual processor or dual core machines would be ideal here.
The Media Server
These are the same as file servers but need a lot more CPU power and probably a separate database server (for the same reason explained in the “Workhorse” explanation). More spindles here = more better.
Do I Need to Upgrade?
Don’t rush into a server upgrade “just because” … look at your current utilization patterns — install sysstat so you can at least use SAR and make RTG’s, and estimate your usage. Is your server running at 25% or 75%? If you are at 75%, you might need to split your web and database servers. If you are at 75% and already have made that split, you may need a much better box with application-level caching and threads. I’d recommend against over-shooting your needs since the monthly cost can eat away at you in the end. If you are speculating a 10-15% increase in usage, just double up on the most important server resources go increase them by about one-and-a-half times if you already have a beast of a machine.
Don’t get caught up with RAID configurations if you would be better served with two machines with more RAM and CPU. In the end, it’s not about uptime or how much you are paying for a server each month; it’s about the most efficient way to use what you have so you can spend your money where it is needed.
Making the Move
Most of the forum posts I’ve read were about people who hate migrating from server to server or about how horrible the process is for their customers typically don’t have much experience in the process. The more you do it, the better you become at it (not really a novel idea, I know). My experienced advice: you need at least two weeks to get it done and done right. Why two weeks? Everyone knows DNS is a pain and so are custom-installed perl/pear modules … remember in ’04 when you installed Compress::LZO for that one customer?
I hope this helps!
-Kevin Landreth, RHCE
Technology Architect












