OnlineOrNot Diaries 22
Max Rozen (@RozenMD) / November 22, 2024
Only three months since the last diary. Slightly better than last time.
Here's how running a SaaS has been going over the last three months.
Table of contents
I fixed four-year-old code
Some code issues only show up when you operate at scale (another reason to just ship). In my case, OnlineOrNot's dashboard is full of N+1 queries thanks to my liberal use of GraphQL without thinking about it too much.
There's enough data in the system now that inefficient queries and poor architecture decisions make for a worse user experience, so I've been taking the time to fix things.
For example: it got to a point where my own personal view of OnlineOrNot was taking 10 seconds to load 10 uptime checks (this screen):
The fix was remarkably simple: instead of using sub-resolvers (and individual query per field with a squiggly bracket) for queries like:
checks { id name url data { timestamp result ... }}
I started fetching all of the data for checks
in the root resolver, and it now takes 300ms instead of 10+ seconds.
Makes me wish I just wrote the whole thing using REST APIs to begin with (likely something I'll migrate to over time).
I realized AWS Lambda is too expensive.
OnlineOrNot is in the enviable position of being default-alive - the minimum cost of operating the business if usage goes to zero is about $30/mo (a small but reliable Postgres DB running in AWS RDS).
As a result, I've never really worried about the business's profitability - as long as more money came in than I spent per month, it was fine. Then I started paying attention to folks on social media bragging that they were running their extremely large businesses on a $5/mo VPS (nevermind the cost of the DevOps person on 24/7 on-call in the background ensuring it never catches fire).
I realised I was paying way too much for serverless compute, because 99.99% of my AWS Lambda execution time was spent waiting for IO (loading websites to see if they're online, running SQL queries).
On Cloudflare Workers, that's free.
So long story short, I rewrote OnlineOrNot to run on Cloudflare Workers, and suddenly I have breathing room for a marketing budget, or even employing folks.