Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Where else have you seen this application level scale to zero pattern in use ? Is there a catchy name for it? #4

Closed
mrchrisadams opened this issue Jul 22, 2023 · 2 comments

Comments

@mrchrisadams
Copy link

mrchrisadams commented Jul 22, 2023

Hi Simon!

I discovered this scale-to-zero repo when doing a bit of nosing around the datasette ecosystem to see if there as a nice equivalent in datasette for django's nifty runserver command1, that automatically reloads when a code change is detected, and I really like the implementation - thanks for publishing it open source 👍

I was doing some research into this for some work on this Google summer of code project I'm mentoring on, for building sustainability principles into Wagtail (and ideally upstreaming these to any other interested communities), and I was looking into how you would do scale to zero behaviour at an application level, like fly.io supports.

It looks like this datasette plugin implements a similar pattern to the one I was experimenting with and outlined in this gist, but goes quite a bit further.

One thing we'd like to do on the GSOC project is get together an example setup of application level scale to zero for Wagtail (and by extension, any django project using something like Gunicorn), and I'd like to refer to existing work, if possible.

Are you aware of a name beyond scale-to-zero used for this pattern?

If it helps, I'm trying to emphasise that this pattern can be used in lots of places, and can be specified at an application level, instead of being something that happens at the container or platform level, because concurrency can work very differently for applications at that level.

Footnotes

  1. I haven't found that yet, other than wrapping datasette with entr as outlined in Julia Evan's blog, but that might be a future summer project for me.

@mrchrisadams
Copy link
Author

Oh, hang on, Fly.io's docs seem to use a different term from scale-to-zero, that might be useful.

Machines are also the spawning ground for new platform features like wake-on-request (also known as scale-to-zero). You can stop a running machine to save on compute costs. It then may be started automatically when a request arrives at the Fly proxy.

Source: Fly Machines by @flydotio

This is from a blog post about doing this trick with an Pheonix app:

When a Fly Machine VM's main process exits, that VM enters a stopped state, but it isn't destroyed. The Fly.io platform proxy will try to wake up a stopped machine automatically in response to incoming connection requests, so with this recipe we can build a scale-on-demand Phoenix app!

Since HTTPS for our application on Fly.io is terminated at the load balancer, we don't need to worry about HTTPS connections.

Source: Shutting down a Phoenix app when idle by @flydotio

Anyway - this doesn't seem like it needs to be tied to Fly.io, even though they make it comparatively easy.

@simonw
Copy link
Owner

simonw commented Feb 29, 2024

I've seen scale-to-zero implemented by Heroku, Vercel, Glitch and Cloud Run. I can't remember other specific terminology for it, I don't know where I first heard the "scale to zero" term but it seems to be the most common way this is described.

@simonw simonw closed this as completed Feb 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants