Cookies Psst! Do you accept cookies?

We use cookies to enhance and personalise your experience.
Please accept our cookies. Checkout our Cookie Policy for more information.

Small things add up

For years I’ve used YSlow and PageSpeed to profile page performance on 4chan. Page performance has always been important to me for two big reasons: 1) I browse 4chan daily and can’t stand slow websites (especially one I control!), and 2) the site is both operated on a shoe-string budget and quite large, so even small changes that result in savings are worth investigating. To that end, we’ve done our best to adhere to best practices.

One thing that YSlow and PageSpeed have complained about for years is that we’ve served static content from a cookied domain, adding unnecessary request overhead.

If you’ve been linked directly to a Facebook photo, you may have noticed the domain wasn't facebook.com, but instead something like fbcdn-x-x.akamaihd.net. Large sites load static content from special domains for a few reasons, but primarily to reduce request overhead, and sometimes security.

So we recently switched our static domains over from 4chan.org to 4cdn.org, resulting in one large improvement, and one small side benefit.

First, the small side benefit. When considering a domain to use, I had the option of choosing between a longer domain (ie. images.4chan-cdn.org) and a shorter one (ie. i.4cdn.org). The average page may have ~125 or so of these links, and the difference in page size between the two is around ~50 bytes compressed.

50 bytes may not seem like a lot, but when you’re serving 500 million pageviews per month, it adds up. This small change will save us about 23 gigabytes of transfer per month, and ~275 GB over the course of a year.

The larger savings will be realized by users. Despite doing our best to keep cookie size down, our use of Google Analytics puts the average user’s cookie size around 1 kilobyte. Because these cookies are sent with every request made to content hosted on 4chan.org, the average user must send 4chan roughly 100 KB of data per page load to receive the response. On mobile networks or for users with home internet with data caps, this can be significant.

By migrating to the new domain, end users now save roughly 100 KB upstream per page load, which at 500 million pageviews per month adds up to 46 terabytes per month in savings for our users. I find this unreal.

Are these optimizations the first place to start? No, certainly not—the reason we made them is we had exhausted almost every other page performance trick. But at the scale of large sites like 4chan (especially those run on a shoe-string budget!), it’s important to remember: little things do add up.

Last Stories

What's your thoughts?

Please Register or Login to your account to be able to submit your comment.