Skip to content

SolutionsPer-user backends

An instance for each user

A key in the request routes each user, tenant or agent to an instance of its own, which keeps its memory and disk and sleeps between requests.

Read about keyed instances

Python
from glac import Glac

glac = Glac()
app = glac.cube.deploy(
    "ghcr.io/acme/notes:2", name="notes", port=8080,
    keys={"from": {"header": "X-User"},          # the key
          "delete_after_idle_ms": 30 * 86_400_000})
# a request with X-User: ada reaches ada's own instance
ada = app.instance("ada")         # or make or wake it from code

State per user, paid per hour

A process for each user is the simplest design, and kept running it is paid for while they are away. Here each key’s instance sleeps between requests and pays only for what it keeps.

a month for the memory alone of 10,000 instances of 256 MiB kept running, at the list prices1
$14,600.00
for the same instances asleep, each keeping 100 MB1
$20.00

How a key routes

Set keys.from to a header or a segment of the path. A new key’s first request makes its instance; every later one reaches the same instance, with its memory and disk. Requests without a key share the app’s instances.

An app and its instances: with keys, each instance is one key’s, awake for its requests and asleep after them.

What each user’s instance gets

  • Choose the shape: shared instances, or one for each user’s key.

  • A key from the request, in a header or the path; the first makes its instance.

  • State per user: memory kept across sleep, its own disk, and a volume.

  • What it costs: asleep, no CPU, only what it keeps.

  • A lifetime you choose: deleted after sleeping that long, made again by its key.

  • Usage per key, from the key each instance carries as a label.

Read the docs

Illustrative previews

Measured, not promised

Medians on bare metal with nothing else running: a best case, and we say so. A key’s instance is the same kind as a sandbox, where these were measured. How we measure

to wake a sleeping instance2
3.5 ms
for the call that woke it, sent to answered2
6.7 ms
to put it to sleep, with its memory and processes2
2.3 ms

See it for your own keys once the service opens: the log’s line for a request that woke an instance says how long the wake took.

Shell
glac cube logs notes -f
# one line a request; one that woke an instance says how long it took

The products it uses

A month, worked out

Ten thousand users, each with an instance of their own, at the list prices. Estimate your own

The use

  • 10,000 users, each with an instance of their own, 256 MiB in use.
  • Each user makes 300 requests a day for 30 days, 20 ms of CPU and 5 KB an answer each, at random times.
  • An instance awake while it answers and for 100 ms after; asleep, each keeps about 100 MB.

A month at the list prices

$72.80

  • CPU1.8 billion CPU-ms × $0.01 / M$18.00
  • Memory750 GiB-h × $0.008$6.00
  • Requests90 million × $0.30 / M$27.00
  • Traffic out450 GB × $0.004$1.80
  • Kept asleep1,000 GB-months × $0.02$20.00

On Paid this month is $70.00: the $5 fee, and $65.00 past what its inclusions cover, from your balance at the same prices.

Give each user their own

A key, then an app with keys.from, deployed with one call.

CubeThe Python SDK