AWS Builder Center

A Restart Budget for an LLM-Backed Web App: Deciding What Is Allowed to Bounce Production

When a model call can take a long time and a customer's site is mid-edit, a restart costs more than usual. These are the rules we use to decide what may restart production and when, plus how you'd set up the same rules on AWS.

By Zahi Raifer
Disclosure: I build Orivox, the AI website builder this post describes. The AWS section at the end shows how to set up the same rules with AWS services. It doesn't describe our own hosting.
Most uptime advice is about keeping servers alive. I've found it more useful to look at the opposite question: what is allowed to restart our app, and when? With an LLM-backed product, an unplanned restart costs more than usual. A model call that was cut off has to be paid for again. A half-finished edit to a customer's live website is the worst state the system can be in. And debugging gets much harder when the code that's running isn't the code you think you released.
Orivox lets small-business owners change their live site by typing a request. A model plans small, named operations and Python applies them. Every save is checked, committed to Git and reversible. Below are the rules that decide what may bounce production, and why each one exists.

Rule 1: Only a release may restart the application

Services restart only when we release. Operating-system updates never bounce the application on their own schedule.
That sounds like plain hygiene, but its value is causal. If a service restarted, we know why: someone promoted a release, and the admin dashboard has a record of it, with a backup of what it replaced. "It restarted at 03:12 and nobody knows why" stops being a type of incident. When something looks wrong, the first question, "what changed?", always has a written answer.
It doesn't mean we skip patching. Patches still get installed. What changes is when they take effect: in a window we pick, on the standby server first, and not whenever a package manager decides.

Rule 2: Nothing a customer waits on runs inside a web request

Edit turns and other long-running work go through job queues backed by Redis, so a web request never waits on a model. That's usually described as a latency decision. It's also a restart decision.
When the slow work lives in queued jobs, the web process holds very little that a restart could lose. The request that started a job finishes fast, and the job is handled by a worker. It also sets up the next rule: the project lock is held for the whole turn, across every process, so a restart can't leave two writers working on the same site.

Rule 3: One writer per project, for the whole turn

A single lock covers a whole edit turn across every process, so two changes can never interleave on the same site. Each turn ends in its own Git commit, and the original site is committed as a baseline before the first edit.
Here's how that works out for restarts. A turn either reached its commit or it didn't. If it did, the change is saved and reversible. If it didn't, the server didn't save it, because only the server decides whether a turn is saved. In both cases the next process to pick up the project starts from a known, committed state. A restart can't leave a "half applied" version behind, because there's nowhere for one to live.

Rule 4: Components that own nothing are cheap to restart

Owners can also edit their site from their own Claude, through a remote MCP server. We built that server to own as little as possible:
  • It keeps no session state between calls, so any instance can serve any request.
  • It holds no database write credentials. It calls the editing service and the web app over HTTP and reads a single read-only view to identify the caller.
The payoff is that restarting it costs at most the one request in flight. We don't have to drain it carefully or schedule it at night. The rule I took from this: if a component is expensive to restart, look at what it owns. Usually it's state that belongs somewhere else.

Rule 5: Restarts happen on the server nobody is using

Production runs on two identical servers, and only one of them takes traffic at a time. Each holds the full stack, meaning the web app, the editing service and their job workers. Every customer's site files sit on shared storage that both servers mount, so either one can serve any site. The web app and the editing service each have their own switch, so one can move without the other.
So "restart production" almost never means restarting the server customers are using. New code goes to development first, then to the standby. It's checked there, and only then does traffic move. Rolling back means moving traffic back. The restart has already happened by the time anyone depends on it.

Rule 6: Verify the restart did what you think

A restart you can't verify is just a guess. We confirm a release by hashing the files that are actually running instead of trusting a version label. A probe outside the system walks the AI connector end to end every five minutes, from discovery and sign-in to a real tool call, and sends an incident email on any failure and again on recovery.
Those two checks turn "it restarted fine" from a feeling into something we can measure.

Doing the same on AWS

None of this depends on a particular cloud. If you build a similar app on AWS, here is how each rule could map onto AWS services:
Rule
One way to get it on AWS
Only a release restarts the app
Patch with Systems Manager Patch Manager inside a Maintenance Window. Run  AWS-RunPatchBaseline  with  RebootOption  set to  NoReboot  on the active instance, and do reboots on the standby. On Ubuntu, set  Unattended-Upgrade::Automatic-Reboot "false";  and set needrestart to list restarts instead of performing them ( $nrconf{restart} = 'l'; ).
Slow work off the web path
Keep the Redis queue on Amazon ElastiCache, or use Amazon SQS. Workers run as their own service.
Shared site files
Amazon EFS, mounted by both instances, so switching traffic doesn't move any files.
A switch, not a rebuild
Two target groups behind an Application Load Balancer. Moving traffic is a listener change, and rollback is the same change in reverse.
Cheap-to-restart connector
Keep the MCP service stateless behind the load balancer, and give its IAM role and database user read-only access to exactly what it needs.
Verify from outside
A CloudWatch Synthetics canary that runs the full connector flow on a schedule and alarms on failure and on recovery.

The short version

Make a list of everything that can restart your production app: package updates, reboots, deploys, crashes, someone running a command on a server. Check each one against two questions. Did we choose this moment? And does the system end up in a known, committed state afterwards? If any item fails either question, you'll eventually get an incident from it, and you can fix it now instead.
More about how the editor is built:  https://www.orivox.pro/ 
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article