What if Cloudflare Workers had been built for .NET?
That's Isoplane. It runs your async .NET web app as lightweight WebAssembly instances, built to pack a lot of apps onto very little hardware.
Most hosting scales up hardware with how many apps you run.
Isoplane scales up hardware with how much work they're doing.
How it works
Each app's startup runs once
When you deploy, we start your app on top of a memory snapshot taken
from a pre-initialized runtime, and fire the Initializing event so your
code can warm itself up. After your warmup routine finishes we take a
snapshot of your app's memory and store that as a template.
Instead of running every time your app starts, your startup code only ever runs one time, on deploy.
Instances are created on demand
When the first request arrives we create a new instance of your app from a copy of the template. Your application was pre-warmed during template capture, so the startup work isn't repeated.
A sleeping app answers its next request without starting from scratch, even if there's no copy of that app loaded into memory when the request arrives.
Code runs in short slices
Request handlers are async methods. Async methods execute as a series
of code segments separated by await. We call each segment
a slice. An instance occupies an execution thread only for the duration
of a single slice, freeing up the thread to do other work when waiting
for results from async operations.
Every await hands the thread back, and adding more instances does not require adding more threads.
The engine handles I/O
When an instance awaits async I/O, the Isoplane runtime forwards the call to the engine's platform abstraction layer (PAL), which runs outside the WebAssembly sandbox. The PAL checks authorization, then either queues the operation in the I/O waiting area or returns an error that the runtime raises as an exception.
The reactor thread pool handles pending I/O. A reactor thread starts each operation, then does other work while the operating system handles the I/O. When the operation completes, a reactor thread places its completion in the ready queue. The instance resumes when an execution thread pops the completion off of the queue.
A small pool of reactor threads can manage many concurrent I/O operations. This lets each instance perform multiple async operations at once, even though it is single-threaded.
Waiting is too cheap to meter
To keep things fair, requests have a limited running time allowance, but they can take as much wall clock time as they need. A request's running time is measured as the time its slices take, plus the time reactor threads spend on its I/O. Time spent waiting between slices doesn't count toward running time.
A slow database doesn't use up a request's running-time allowance.
Idle instances are evicted
An instance that hasn't had a request for five minutes is discarded. Nothing is lost, because a new one is fast to create when the next request arrives.
An app that nobody is using scales to zero by default.
Putting it all together
Each app's startup runs once. Instances are created on demand. Code runs in short slices, and the engine handles I/O. Waiting is too cheap to meter, and idle instances are evicted.
The result is maximal work from minimal hardware.
Our engineering target is 1,000 instances of typical .NET API workloads on a single 16-core machine with 64 GiB of memory.
Run it yourself today. Let us run it soon.
Isoplane is free and open source under the Apache 2.0 licence, and you can host it yourself right now on Linux x64, Windows x64 and macOS on Apple silicon. A hosted version is coming soon, starting with a free public beta.