Infrastructure Obesity Crisis
There is a talk by Maciej Cegłowski named The Website Obesity Crisis. It is quite old, but still relevant. I have stumbled upon a problem similar to what Maciej is discussing, and I found both the issue and the solution quite interesting. You should give it a read.
Seeing Maciej talk long time ago, discussing page sizes, made an impact on me. Perhaps partly due to this my blog is quite lean, as you can probably see yourself. There isn’t much logic in it, nor does there need to be. It’s primarily a collection of text essays, couple of images, and enough JS and CSS to keep it working. Each blog page has some text, typically a couple of well compressed images, and a bit of metadata. It is functional, easy to maintain, loads fast, and runs well. The entire blog - all of it - is just over 1.1MB as of writing this post.
The backbone of the blog in form of hugo platform is also fairly lean. node_modules clocks in at 880Kb, CSS is just a couple of Kb. It’s lean to the point of perhaps being too lean. This isn’t bragging, it’s just natural evolution of a system where the design from the get go was to be simple and rely on yml + webp structure.
So I was quite surprised when working on moving the blog to AWS Amplify I noticed the first bun install is taking quite a while. It turns out just the four necessary wrappers for Amplify in the TS ecosystem end up being 1.1GB. 3 orders of magnitude more than the entire contents of the blog, all to just put some files on Amazon servers. The infrastructure to generate and host a handful of static files and images was 1,000x more than the files themselves.
This made me start thinking about the infrastructure weight I have been seeing lately. Projects I follow getting larger and larger. Build toolchains getting more complex. Downloads measured in hundreds of megabytes for seemingly simple tools. And that trend has accelerated - to me at least - in big part due to AI and LLM tendency to have a blind spot for performance.
You see, the 1,000-fold increase in the node_modules size of my blog was me just getting Amplify set up to work on deployment. Had I not inspected the infrastructure, this would have slipped under typical “oh just ship it, it’s infra glue” thinking. Yet I felt like I’m not seeing something obvious - how is it that I need so much work just to make people access my page?
It turns out I don’t, and that all I really needed was some simple scripts to put the page on S3 through deployment via github actions, without Amplify and the baggage it comes with. A couple of YAML files got me essentially the same result - just without massive cost of huge npm downloads, caching deps and all that nonsense.
All of this makes me both worried. It’s never been easier to duct-tape code together without much thought put into performance. At the same time, it’s never been easier to optimize the living hell out of something by using LLMs. I am seeing projects both huge and quite complex, such as hermes, which embrace “bandwidth is cheap” mentality, as well as some amazing rewrites in Rust that achieve insanely good results in just a handful of MBs. And maybe that’s the lesson to be learned, maybe the world is further splitting into K shaped internet, with some projects being lean and fast, and others - not so much. And maybe that’s OK.