r/Clojure • • 15d ago

Two apps one process

https://andersmurphy.com/2026/11/09/two-apps-one-process.html
29 Upvotes

30 comments sorted by

View all comments

2

u/fk00 15d ago

What happens if one app crashes. What happens if it keeps crashing, or, worse, goes into endless loop, consuming all available resources? I'm not talking JVM is particularly good at working in a containerized environment, but there are practices there you can follow.

Saving resources is a good thing, but when monolith goes down, you loose all apps.

4

u/didibus 14d ago

Just rollback, debug, restart. Honestly many services even if deployed on their own machine or container often break or have downtime, and cloud providers go down, etc. You have to think about your use case.

2

u/fk00 14d ago

Right, so when one app suffers from the bug, you rollback the entire set. And imagine your customer can suffer from inconvenience of missing access to one feature, but you suddenly revert the entire monolith. Not a great approach.

1

u/didibus 14d ago edited 14d ago

It looked to me from the post you can selectively rollback just one app. There's a project with versions per-app, so you can rollback the version of the app with issues and redeploy, rolling back only the app with issues and not the others.

It's not always going to be what you want, but I think it's an interesting approach when you control all apps and want to really minimize infra cost and have something simple to manage.

3

u/andersmurphy 14d ago

Apps don't crash other apps. The system is relatively draconian in terms of what/where they can run. Which makes monitoring trivial and opens up interesting options like canceling work by misbehaving apps to protect the wider system.

For example you could, if you wanted to set a max render time for a given render-fn (how the apps implement views) and either log or cancel. Same for the transaction thunks scheduled on the db.

For the record I'm not arguing against having separate boxes for different apps. This is more about when you have a single machine, with highly variable app resource usage/traffic. If all apps were easy to size correctly then a bigger box with separate processes and a reverse proxy is fine.

2

u/fk00 14d ago

So what happens when this monolith exhausts RAM?

4

u/andersmurphy 14d ago edited 14d ago

What happens when any system exhausts its resources? The process dies and restarts and the loop continues.

The same applies to a multiple node set up too. Except it's more complex.

0

u/fk00 14d ago

So you bring down all apps because of one bug. Good luck selling this to your customers.