6 ms·
> 50 bytes may not seem like a lot, but when you’re serving 500 million pageviews per month, it adds up. That's a void argument in the article. If they were se
by quchen 13y ago
> 50 bytes may not seem like a lot, but when you’re serving 500 million pageviews per month, it adds up.
That's a void argument in the article. If they were serving pages with 500 bytes each this would indeed be a huge improvement, but no page is 500 bytes. I just opened 4chan.org, and the markup before <body> is already 1,836 bytes. The entire frontpage of /b/ is 114,428 bytes, and saving 50 is absolutely negligible. On the other hand, if saving single bytes was significant, there would be a lot more potential in the source by shortening CSS class names etc. rather than picking a short domain name.
EDIT: According to http://www.4chan.org/advertise http://www.4chan.org/advertise, there are a total of 575,000,000 monthly page impressions.
- sliverstorm 13y agoThat's still 25GB/month of bandwidth they save. Who knows, maybe that nudges them out of a high-cost data tier.
- quchen 13y agoMy point was that "saving 25 GiB" is way below anything they can possibly care about. How much traffic does 4chan handle in a single hour? I think it's pretty safe to assume that 25 GiB is significantly lower than one standard deviation of their monthly traffic, so cutting costs with it is also not feasible.
- sliverstorm 13y agoOk, so let's assume you are right. Did he make the wrong choice? The shorter name seems strictly better to me- whether we feel it is trivially better, it saves traffic and the domain name has lost no information. If he reworked old code just to save 50 bytes, that would probably be a mistake, but it sounds like the work was being done anyway and he had the choice to save 50 bytes OR use a longer domain name.
- moot 13y ago> If he reworked old code just to save 50 bytes, that would probably be a mistake, but it sounds like the work was being done anyway and he had the choice to save 50 bytes OR use a longer domain name. Basically this. I thought it was an interesting side benefit that came at no additional cost to the main benefit of greatly reducing request overhead for static resources.
- iriche 13y agoYou often pay less per GB the higher you get
- wvenable 13y agoYou are looking at the traffic sent by the server to the client but cookies are sent by the client to the server. Upstream vs. downstream. Cookies are much larger proportion of the request. Also the response can't even be sent until the entire request is retrieved.
- sk5t 13y agoExcellent point... we can also safely assume the average user's upstream connection is quite a bit slower--likely on any metric other than latency--than his downstream. In addition, let's not forget to multiply the cookie overhead by the number of images on the page... likely to be quite a large number given 4chan's love of images and enormous, eager-loaded discussion threads.
- pavel_lishin 13y agoSure, but that's just by pointing image URLs, etc., to a shorter domain vs. a longer one. There's also savings in not sending cookies with every image request - which saves them a honkin' 46 terabytes. Plus, he himself admits that this isn't the first place to start optimizing - it's just where he chose to.
- jbverschoor 13y agoThey have around 100 images on a single page, and google analytics increases the 50 bytes with 1KB. This does indeed result in 100kb overhead
- moot 13y agoI think you're confusing the two benefits. What the thread OP is talking about is the decrease in page size from the URLs included in the page source. Choosing a shorter URL for the static domain versus a longer one resulted in a rough savings of 50 bytes per page (size), compressed. You're referring to request cookie size, which was also decreased significantly (CloudFlare still sets a single cookie, unfortunately), which results in the big savings of ~100 KB upstream per page load.
- psykovsky 13y agoKind of off-topic, but how do you feel about doing a conscious MITM to your users(by using Cloudflare), being 4chan home of Anonymous and all that?
- icebraining 13y ago4chan logs IPs and provides them to the cops if the ask, so it's not like users who want to remain completely anonymous can do so without being behind seven proxies anyway.
- moot 13y agoYou're absolutely right -- it is negligible. When you're serving upwards of a petabyte per month, 23 GB isn't exactly a lot! > On the other hand, if saving single bytes was significant, there would be a lot more potential in the source by shortening CSS class names etc. rather than picking a short domain name. Also spot on, but the point I was trying to make is I was given the choice of choosing a longer domain and a shorter one, and the shorter one resulted in smaller page size, which does result in some (though as you put it, negligible) savings in terms of transfer. CSS/JS refactoring/pruning would definitely be a better bang for your buck if your goal was solely to reduce page weight, but my primary goal was to decrease request overhead and this was just a side benefit at no additional cost to me. As an aside, I would say the non-technical benefit of the longer domain (4chan-cdn.org) would have been avoiding user confusion, but I feel this is mitigated since visiting 4cdn.org directly bounces you to www.4chan.org and our custom error pages make 4cdn.org clearly 4chan related.
- quchen 13y agoRight, if you use a short domain name "because why not" for something new that's alright. It was just the "it adds up" part that I was commenting on. Do you have (well, you're moot, so -- want to share) some more data of 4chan's current size? I'm sure lots of people would be interested in hearing about that. (This would probably make a great individual post.)
- Killswitch 13y agoI'd be very interested in this... I used to visit 4chan all the time back in the day, not so much now, but I do enjoy reading statistics about the site. Thanks for this article moot.
- moot 13y agoI've been meaning to write a post about all of the weird stuff we do in the interest of maximizing our limited resources. We've always had to stretch things as far as possible given server, financial, and time constraints, which has led to some interesting/unorthodox "solutions."
- lucb1e 13y ago> > 50 bytes may not seem like a lot, but when you’re serving 500 million pageviews per month, it adds up. I thought you were quoting me here, I wrote the same text yesterday only with a figure of 100 million pageviews. That was weird to see.
- nl 13y agothe markup before <body> is already 1,836 bytes All those bytes are justified because they are rendered on the screen provide direct utility to the user. The extra 50 bytes does nothing but slow the page down. there would be a lot more potential in the source by shortening CSS class names etc There is no either/or here: this can and should be done as well.
- metafunctor 13y agoIs 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 require certain class names to be used Just wondering if there's any work already done with this approach.
- columbo 13y agoI don't think there's anything that will change the class names, but there are minifiers http://yui.github.io/yuicompressor/css.html 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'
- ygra 13y agoBut 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).
- coldtea 13y agoNo 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).
- parallelist 13y agoIf the few bytes saved by this new domain seems worth commenting on what about the very large number of unnecessary whitespace characters they are serving?
- epo 13y ago> 50 bytes may not seem like a lot, but when you’re serving 500 million pageviews per month, it adds up. This is rubbish. What matters is how many packets of data go through the network. It is packets which are the unit of transfer and which are handled by intermediate nodes. The difference between say 2340 and 2290 bytes is of no material consequence whatsoever, it may cause one less packet to be sent but probably won't. To think it does have a consequence is to demonstrate a complete lack of understanding of what happens in the network and in endpoints. None of these '50 byte savings' accumulate anywhere in any meaningful or measurable sense whatsoever. So no, it doesn't "add up" to anything. And if you're going to downvote me explain why I am wrong and how the benefit of these mythical 'savings' can be demonstrated.
- prodigal_erik 13y agoPackets are not padded to the MTU, so a link literally needs more time to send a longer packet. If you make a response 50 bytes shorter, the last packet will always clear a 1 Gbps link 0.37 ms sooner, even before you shave a packet off 3% of your responses. How much you care depends on what you're doing and how bursty it is, but it's certainly measurable at scale.