Hack #18. Avoid the Slashdot Effect

Add web cache links to Slashdot articles.

Reading Slashdot is one of my guilty pleasures. It is a guilty pleasure that I share with tens of thousands of other tech geeks. People who have been linked from a Slashdot article report that Slashdot sends as many as 100,000 visitors to their site within 24 hours. Many sites cannot handle this amount of traffic. In fact, the situation of having your server crash after being linked from Slashdot is known as the Slashdot effect.

Tip

Read more about the Slashdot effect at http://en.wikipedia.org/wiki/Slashdot_effect.

This hack tries to mitigate the Slashdot effect by adding links to Slashdot articles that point to various global web caching systems. Instead of visiting the linked site, you can view the same page through a third-party proxy. If the Slashdot effect has already taken hold, the linked page might still be available in one of these caches.

The Code

This user script runs on all Slashdot pages, including the home page. The script adds a number of CSS rules to the page to style the links we're about to add. Then, it constructs three new links—one to Coral Cache, one to MirrorDot, and one to the Google Cache—and adds them after each external link in the Slashdot article.

Save the following user script as slashdotcache.user.js:

 // ==UserScript== // @name Slashdot Cache // @namespace http://www.cs.uni-magdeburg.de/~vlaube/Projekte/ GreaseMonkey/ // @description Adds links to web caches on Slashdot // @include ...

Get Greasemonkey Hacks now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.