Live data from Hacker News

Small things add up: 4chan's migration to a cookieless domain

chrishateswriting.com

111–120 of 139 posts

Re: Small things add up: 4chan's migration to a cookieless domain

#111

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?)

The initial request from browser to server, I presume.

Re: Small things add up: 4chan's migration to a cookieless domain

#113

Earlier 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).

You could do that and gzip though; it would probably yield some savings.

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

#114
post #31

Earlier 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

Why even write the html to disk? 4chan flushes history so aggressively I'd think you could fit all the high-traffic stuff in memory.

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

#116

A 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?

Yes. Along with base64ing the logo. Better to serve those with some nice HTTP cache headers.

Re: Small things add up: 4chan's migration to a cookieless domain

#117
post #27

moot, 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...

A board for WebP animations would be amazing.

Re: Small things add up: 4chan's migration to a cookieless domain

#118
post #82

Earlier 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'

But that's the same problem as minifying JS libraries already, where you have a set of public symbols that should not be altered. An exclusion list works well in that case where you could just put the class named that are for dynamic generation (you probably don't do that with all classes in the stylesheet).

Re: Small things add up: 4chan's migration to a cookieless domain

#119
post #86
post #74

Earlier 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.

So you never encountered any problems with the free usage tier and its limitations? Asking out of curiosity, as we use it as well and break the hit-limits every month. My direct supervisor asked me, if I envisioned problems, and I told him, Google does not guarantee, but delivers non the less (as far as I knew at that time).

How do you feel about the believability of the data?

Re: Small things add up: 4chan's migration to a cookieless domain

#120

Earlier 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.

yep, this process just speeds up the process. Images are something that really can NOT be protected. If they are visible, they are steal-able
Post reply on HN