
Quality VS Performance VS Costs
Breaking the site to make it better
It’s been going great with my site. I’m not getting any real visitors yet — mostly just malicious bots and the usual internet background radiation — but I’m genuinely happy with the site, the performance, and the overall experience.
And then, last weekend, I messed it up.
How I broke it
It happened for a multitude of reasons, and the end result was so bad that the site became almost unusable. I’m not going to dive too deep into the how and why — instead, I’ll focus on the positive outcome.
It all started with a random news item in my feed: Next.js 16.1.0 released. Hardened security + optimized performance? Solid sell.
What nobody mentioned was the cost.
I upgraded Next.js, React, TypeScript, rebuilt the app… and to my surprise, everything came up without errors. The site seemed to be working. I had wiped the Next.js cache, so some initial slowness was expected.
Unfortunately, that wasn’t initial slowness.
It was a disaster. 😄
The real problem
Next.js quietly changed my next.config and set AVIF as the default format for next/image optimizations. That single change absolutely destroyed my poor infrastructure and tiny VM.
It wasn’t the only issue, but it was one of the root causes.
The app service started crashing constantly due to OOM conditions and CPU spikes. The VM was struggling. The temporary cache partition was being remounted as read‑only over and over again.
Total mess.
From a user perspective, though, things looked deceptively fine. Authentication, comments, and profiles all worked. The only symptom was painfully slow galleries and albums — loading a single image took around 10 seconds on average.
The pipeline looked something like this:
Browser requests image
→ Apache
→ Next.js
→ Download ~7 MB JPG from Supabase
→ Resize + compress to AVIF (very CPU‑heavy)
→ Save to /mnt
→ Serve back through Apache
→ Browser
Yes — I was serving original camera JPGs. One of the original ideas behind this project was maximum photo quality.
That idea is now officially in the bin. 😄
Trade‑offs and reality
I gave up quality for performance and cost.
And honestly? That’s the natural course of things — especially when the infrastructure is minimal and paid entirely out of pocket. I’m actually quite happy with the current results.
The unexpectedly positive outcome
What’s the positive in all this?
I got so frustrated that I asked AI to do a complete security audit, performance tuning and optimization, and a full code review — with a focus on aesthetics and visual polish.
The results?
WOW.
I’m genuinely impressed by what AI managed to do in just 2–3 hours. And to emphasize this once again: I haven’t written a single line of code. I haven’t touched a single config file. I’ve simply been acting as the interface between the server and the AI — copy, paste, apply.
All the AI skeptics can hopefully quiet down a bit. Yes, AI takes jobs. Yes, it makes some roles and degrees obsolete.
But AI is also very clearly the future.
AI plus robotics… and humans are cooked. 😄
What’s next
Oh — and the constant internet noise? The attacks, the probes, the malicious bots?
That’s a topic for another blog post.
Discussion
Comments on this post
Loading comments…
Sign in to leave a comment.