I never even contemplated the size of cookies before seeing this. It never occurred to me that it could create such an overhead. It'd be incredibly handy if we could set a header like `x-send-cookies: NO` to stop the browser sending cookies along for static content. Great post, a real eye opener.
Set a header where (on which request from whom to whom?)
Small things add up: 4chan's migration to a cookieless domain
111–120 of 139 posts
Re: Small things add up: 4chan's migration to a cookieless domain
#112Re: Small things add up: 4chan's migration to a cookieless domain
#113Earlier quoted context omitted.
Is there a good CSS minifier which looks at the CSS as well as the HTML, and shortens class names automatically? In most cases I don't really care what the class names are in the final HTML, as long as they match up with the CSS. I realize there are a lot of things that could go wrong, such as * correlating the HTML and CSS for an entire site instead of just one page * dealing with third party dependencies that requi…
No need, because you can gzip compress, which will make even better savings than that (because it can also compress and save space taken by tags etc, not just class names).
An obfuscator generating code à la iocc efficiency would be quite neat (e.g. http://www.ioccc.org/2012/endoh1/endoh1.c)
Re: Small things add up: 4chan's migration to a cookieless domain
#114Earlier quoted context omitted.
We write pages to disk as compressed HTML, and make use of nginx's gzip_static and gunzip modules to serve them. So every time a person posts, we regenerate the applicable reply and index HTML. The high postrate boards are rebuilt with a daemon on a timer, since past a certain point (~1 post per second) it's wasteful to regenerate on demand given how long the script takes to run. We essentially think of flat files on…
Flat files on a disk == awesome
if there's a power-blink and the posts get lost? Its 4chan.
Re: Small things add up: 4chan's migration to a cookieless domain
#115Re: Small things add up: 4chan's migration to a cookieless domain
#116A quick look shows that you could minify the Javascript quite a bit more (which is relatively easy, and would save a lot more than 50 bytes). You might also look at inlining all of the Javascript into the HTML directly (this is what Google does), which saves the extra HTTP requests. You could also do this with some of the persistent images on the page (logo) and inline them with base64 (but I don't think it actually…
Wouldn't inlining the js mean that it's downloaded for every page request instead of being downloaded once and cached?
Re: Small things add up: 4chan's migration to a cookieless domain
#117moot, given that your site seems like an ideal candidate for WebP, why not use it with pagespeed (and/or let users opt to use the format when posting)?
In order to stay compatible with non-WebP-supporting browsers, moot would have to keep two versions of image files on the disk, causing a lot of pain and HDD waste. It could work for the smaller boards, though...
Re: Small things add up: 4chan's migration to a cookieless domain
#118Earlier quoted context omitted.
Is there a good CSS minifier which looks at the CSS as well as the HTML, and shortens class names automatically? In most cases I don't really care what the class names are in the final HTML, as long as they match up with the CSS. I realize there are a lot of things that could go wrong, such as * correlating the HTML and CSS for an entire site instead of just one page * dealing with third party dependencies that requi…
I don't think there's anything that will change the class names, but there are minifiers http://yui.github.io/yuicompressor/css.html Changing the class names would be difficult as it wouldn't pick up any dynamic class names, like var className = 'user_' + user.getState(); //'user_deleted' or 'user_active'
Re: Small things add up: 4chan's migration to a cookieless domain
#119Earlier quoted context omitted.
Have you ever thought of running server-side analytics?
Yes, but every time I've investigated it, the tl;dr was "not worth it" given our requirements/constraints. Google Analytics has its shortcomings, but it's a great product and free.
How do you feel about the believability of the data?
Re: Small things add up: 4chan's migration to a cookieless domain
#120Earlier quoted context omitted.
Nice for you, but potentially not so nice for the poster of the photo who thinks that only his or her friends can access it.
Yeah, I acknowledge it has some less ideal traits as well. Of course, if I can see it, I can show it to anyone, whether or not I can direct-link.