If you run your own webserver, make sure you aren't brought down by the "Slashdot Effect."
Like many techno-geeks I host my LAMP website on a cheap ($150) computer and my broadband connection. I have also wondered what would happen if my site was linked on Slashdot or Digg. Specifically, would my setup be able to survive the “Slashdot Effect?” A Pentium 100mhz can easily saturate a T1's worth of bandwidth and my upload speed is capped (supposedly) at 384kbps, so the server should easily be able to handle that. My bandwidth will be saturated before the server is incapacitated, at least that's the idea.…








Article comments
26 - Chieh Cheng
Forgot to mention that KeepAlive defaults to off:
#
# KeepAlive: Whether or not to allow persistent connections (more than
# one request per connection). Set to "Off" to deactivate.
#
KeepAlive Off
At least it does in Server version: Apache/2.0.40
Server built: Sep 4 2002 17:20:34
27 - MikeTA
A really useful one I set during a slashdoting is the Apache Expires directive. Set this for dirs that contain (mostly) static files like images, so that the browser is told the file expires (say) one week in the future. If your pages have lots of little images - bullet markers, that sort of stuff - this is a big win.
28 - Micheas
Apache2 and Lighttpd seems to benchmark fairly close to each other. (as in both side can make reproduceable benchmarks in their favor,)
Although there is a lot of reasons for us to avoid a monoculture, so I would not discourage using Lighttpd. It seems to be a solid server, but if you have a well tuned apache 2 server, you probably won't see much difference in performance between them. (a well tuned zope server could our perform a badly tuned apache 1.3 server, But apache2 can scream if you spend some time tuning and benchmarking it. (personally I have a soft spot for servers like dhttpd, fnord, roxen, micro-httpd, lighttpd, mzscheme, bozohttpd, cherokee, mathopd, boa, yaws, aolserver, thttpd, caudium, and zope. But, I still user apache a fair amount. It is easy to setup, secure, and administrate. In addition to being well supported by web apps.
Tuning your webserver, and shutting off all unneeded extensions making the content as static as possible, and caching everything you can will get you a lot of the way to being able to withstand heavy traffic. After that you are going to have to benchmark your changes, and figure out where your bottleneck is and go from there.
29 - mrG
+1 on that endorsement of Devin's comments as the sane alternative to the advice in the original article, only I would add one further tip:
Do not use .htaccess files in your most travelled directory as this causes twice the traffic for every page and graphic. Turn options off and set your config in httpd.conf (or conf.d) instead.
also a caveat: When I added that CDM url extension to this post, the form-post would no longer work; that's logical if you think about it (no site should accept form data that's not from it's own URL) but could really trip you up if you weren't expecting it.
Also, I notice the many endorsements for mod_gzip -- I thought mod_gzip was dead! I can't find any current maintained code; what I can find is a royal pain to install, and doesn't like apache2.
I use mod_deflate instead, nearly the same function, easy as a single line of config to install, and pre-included by most Linux distro bundles.
Another noteworthy item from the original article: Is it my imagination, or did the author neglect to give us the URL of that Slash-dot-proof $150 server? Did I just miss it? ...
30 - Watson
I have a server on a fast connection (100Mbit/s). The disks are very fast SCSI disks in a RAID 5 setup and the CPU is about 800Mhz. But I only have 256MB of memory!
What is the best performance tuning solution in this senario when disk, internet connection and CPU is fast but RAM is low?
31 - Adam Drake
Watson:
Option 1: Use Lighttpd, it has a very low memory footprint and is faster than Apache in many implementations.
Option 2: If you must use Apache, make sure you load only essential modules, don't set your MaxClients too high, etc. You can look at some sites that are geared towards that kind of thing, but in the end your best bet is to incorporate the things that work at those sites and see how your memory usage pans out. It will take some tweaking but the payoff will be worth it.
32 - Nikesh
How this perosn get qualified for writing an article on Apache
33 - mauricev
There doesn't seem to be any reference to what the "ideal" worker MPM values should be
(These are the defaults)
StartServers 2
MaxClients 150
MinSpareThreads 25
MaxSpareThreads 75
ThreadsPerChild 25
MaxRequestsPerChild 0
34 - Anthony Cargile
I was a slashdot effect victim recently. My website, thecoffeedek.com had a great story and got slashdotted, and here's how it went with 5 load-balancing lighttpd web servers with an optimized-configuration apache2 as a proxy front (using the proxy mod that does load balancing):
First, the server loads during the peak of the hits (around 12,000 users per second) never made the server load (according to htop) reach above 0.1, and the reason is because the 2Mbps bandwidth buckled almost instantly.
Once the bandwidth was hosed, the servers had nothing to worry about since over half the clients couldn't even get through. But the ones that did hardly even affected the cluster, which on a very high amount of images per page and multiple database hits per page (wordpress) is quite astounding. And the boxes aren't all that great, they're processing speeds and RAM are:
Server 1(front end): 2x800MHz, 768MB
Server 2: 2x800Mhz, 186MB
Server 3: 1.6GHz, 512MB
Server 4: 2.4GHz, 1GB
Server 5: 1.6GHz, 384MB (RAMBUS, too)
So the machines aren't optimal, but they're in a perfect layer 4 cluster, and if the bandwidth were higher they could have easily handled the loads with very little latency. I disabled mod_gzip (or whatever it is now) on account of cluster confusion and processing difficulties. And one last thing: server 1 also is the MySQL database server, NFS, and NIS for the other nodes, so for every reverse proxy he was also getting hit several times (will be fixed in the future), but in its defense it has 2 NICs, one for internet requests only, and one for internal DB/NFS/NIS requests, and again as the most monitored of the systems the load never topped 0.1 average, with 50 days of uptime (still inaccurate because kexec resets the uptime count).
Thats just my 2 cents. If you visit thecoffeedesk.com you can see the server ID at the bottom, or just append #server to the URL. And in the future, a text only backup on coral is overdue.
Thanks,
Anthony
35 - Anthony
Actually, we just got slashdotted again, and this time you could not even notice a speed difference. The biggest thing I did was plug the server directly into the gateway, and bam, no more bandwidth problems on 2Mbps up line. Just make sure you have a firewall on the front end server enabled, and that combined with my above specs, an additional server thrown in, some page whitespace trimming and slight static content conversion made the site perform beautifully at thousands of hits per second, as I said no difference in speed at all!