Power User Monday Tip of the Week
How To Host Slashdot On a Shared Server
This week's PowerUser Monday is brought to you by Scott Kelby's Macintosh The Naked Truth. Read MacMerc's review of it here. If you have a story suggestion, please email it to jon@macmerc.com.
Last week I covered the WWDC Keynote speech live (from the satellite feed shown at the Tampa Apple Store). If you missed it and live in a cave, here's the archive. Like all of our live events it was a complete blast--we had tons of people chatting in AIM/iChat and served an amazing amount of pages to enough people to sell out a basketball arena. The most amazing part of all is that MacMerc is completely housed on a single shared server from the fine folks at ActaDivina.
I
could go on and on, but pictures are better than words. Seen at right what Webalizer made
of our traffic spike. The bright blue bar is pages (the main focus of this
article). That spike is pretty impressive... It's roughly 20 times above our
average. So, what's the secret to being able to handle the load? Static pages
baby.
Most of the cool features on MacMerc are made possible because of the cool technology behind it. On any given news article you can comment, moderate other comments, and sometimes even vote in a poll. On stories like this one you see "blocks" on the right hand side that give you access to some cool stuff. If you're a member (it's free), you can even see how many people are currently at the site.
On any given page load, we have server-side code that talks to our database and fetches the data, formats it, and then exports it off to your browser. It's all pretty neat, but it takes a lot of power to run. I made the decision a long time ago (right after our server crashed during the iTunes Music Store announcement I believe) that we would never try live coverage again without going static.
I wrote a special content management system just for the keynote coverage. It has a pretty slick interface and makes a static page as output. It's also a time saver because it writes all the time stamps and mark up for me. I just plug and chug. This was the only scripting going on for the whole site, and only I was using it.
What's the difference between static and dynamic? When you accessed us during the keynote the database was completely still... No server side programming happened. Your browser said, "Give me the index page" and our server said, "here it is".
To take it a step further, I used mod_rewrite to forward everyone but myself to the static index page. So if you typed in:
http://www.macmerc.com/ilovedellsomuch
You would see the same exact thing as everyone else. This is so we can assure that the server is JUST working on shoving out the index page. The only person that wasn't seeing this page was me because I was doing the play-by-play.
So how did we do? Well here are some numbers/facts:
- At our peak we were serving 150,000 pages an hour
- That peak works out to about 40 pages a second (you should see this fly by on the terminal... really something).
- With almost 500,000 pages served, we only went through about 5 gigs of bandwidth (the page was REALLY optimized). Not having any images really helped things move smoothly.
- We still almost got nuked. The highest load average (via top in the terminal) I've ever seen happened during our peak... Over 100.
- For a few hours we made Slashdot look like a Geocities page. Felt quite good. I felt tempted to try and crash someone's site... Start a tradition of being "Merc'd".
If you're looking for a host that can handle peaks, check out ActaDivina (nope, we don't get anything if you sign up... we just like them). They were superb. They noticed the peak and streamlined Apache to make things a little more smooth. Didn't even have to ask them. If you got any questions (or suggestions, we are going to be doing this again the next time there is a similar event) please let me know. If you're going to be having a similar event and want to find out more about the content management system that I wrote, feel free to ask.
All personal comments should be sent to the author. All other discussion should be done in the Forums
[ Back to Power User Monday Tip of the Week | Sections Index ]





