5 ms·
All of github pages was run off of _one_ server? (with one failover standby). That's pretty amazing. If all you're serving is static assets, apparently you hav
by jrochkind1 11y ago
All of github pages was run off of _one_ server? (with one failover standby).
That's pretty amazing. If all you're serving is static assets, apparently you have to grow to pretty huge scale before one server will not be sufficient.
I'm curious if there was at least a caching layer, so every request didn't hit the SSD. They didn't mention it.
- vog 11y agoI believe this is automatically done by the operating system. Nginx usually performs some kind of mmap of the requested file, and the virtual memory management will automatically take care of caching. BTW, I'm often surprised how people are afraid from opening files from their scripts, as if they think this will always lead to disk access. Then, they start implementing a hand-written caching layer on top of that, which usually performs worse than what the OS already offers.
- deleted 11y ago[deleted]
- falcolas 11y agoIf it's a static file with no dynamic compression (nginx allows the use of pre-compressed assets) or SSL, nginx doesn't even have to open the file, it just uses the sendfile system call.
- shanemhansen 11y agoMinor nit. The sendfile system call requires an open file. nginx can just skip reading the file contents into userspace. Also, BSD has some recent extensions to make sendfile work with ssl [https://people.freebsd.org/~rrs/asiabsd_2015_tls.pdf https://people.freebsd.org/~rrs/asiabsd_2015_tls.pdf] (pdf)
- nomel 11y agoSSD cache and os file system cache is always there. I'm sure they were filled with ram, and that's all it would be used for.
- charliesome 11y agoWe do have Fastly in front of *.github.io, but there's still a significant amount of traffic (on the order of thousands of requests per second throughout the day) that make it through to our own infrastructure. We don't do any other caching on our own, although the other replies are correct in that the Linux kernel has its own filesystem cache which means not all requests end up hitting the SSD.
- fugyk 11y agoWhat percentage of the requests is handled by CDN?
- jsingleton 11y agoI believe that only CNAMEs use the CDN for custom domains (naked domains do not) [0]. So that rules out a chunk but there will be lots of cache misses too. Maybe someone from GH can confirm. [0] https://help.github.com/articles/about-custom-domains-for-github-pages-sites/ https://help.github.com/articles/about-custom-domains-for-gi...
- michaelmior 11y agogithub.io will still also hit the CDN. It's just custom naked domains that will miss.
- toomuchtodo 11y agoTheir docs mention ever 200 response code request is cached, so I'd say a majority of the requests?
- icefox 11y agoAre the assets extracted from git and dumped on the filesystem or are they fetched from the Git objects? aka If I generate a git tree object with millions of files, but only pointing to a handful of blobs (think a maze) would this exploded on the filesystem?
- simonw 11y ago
- kyledrake 11y agoCorrect. Static file serving is amazingly efficient. Even the filesystem caches for you automagically with whatever RAM you're not using. There's even a kernel function for speeding up file transfers, that's how optimized this stuff is: http://man7.org/linux/man-pages/man2/sendfile.2.html http://man7.org/linux/man-pages/man2/sendfile.2.html My rough estimates are that Neocities can handle 20-50 million sites with only two fileservers and a sharding strategy. So double it for each shard, and you've got a solution that actually scales pretty well.
- bkeroack 11y agoIt's not that surprising. Serving static files is pretty easy and lightweight (part of why I like the movement towards SPAs), and there's been 20+ years of work done to make it fast. We've been conditioned for years by dynamic application servers that perform multiple DB queries, external service calls, etc per request. It doesn't have to be slow or inefficient.