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 querie

OnlineOrNot Diaries 22

submited by
Style Pass
2024-11-22 18:30:17

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:

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).

Leave a Comment