◆PRISMFaaS

04 / 12Prism Systems · Cloud-Native & Developer Infrastructure

A serverless orchestrator that fights cold starts

Firecracker-style MicroVM fleet, best-fit bin packing, warm pools with keep-alive, snapshot restores, predictive pre-warming, per-tenant quotas, throttling and GB-second billing — plus real handler execution in an isolated V8 context.

Zero dependenciesVirtual clockSnapshot restoresTenant quotasnode:vm isolate
Live simulator

Watch MicroVMs boot, serve and expire

Four functions from two tenants share four hosts. Fire a burst, deploy a new version, switch snapshots and pre-warming off and on, change keep-alive, or edit the resize handler and invoke it. It really runs in your browser.

paused
MicroVM fleet · width = memory · ▒ booting · ■ busy · □ warm idle
Latency · p50 / p99 (ms)
VMs · busy / warm idle / booting
Functions
FunctionRuntimeMemoryVersionRateVMsCold startIn-flight
Handler · resize-image
Orchestrator events
Features

What's inside the engine

Real algorithms, not mock-ups. The simulator above runs the exact same code you import.

λ

Function registry

Versioned deploys with aliases. A new version drains old VMs: idle ones stop at once, busy ones finish first.

▦

Best-fit bin packing

MicroVMs go to the host with the least leftover memory that still fits. When full, the least recently used idle VM is evicted.

♨

Warm pools

Idle VMs stay warm for keepAlive seconds. Warm hits reuse the most recently used VM, so the pool shrinks naturally.

❄

Cold start model

VM boot + runtime init (node20, python312, java21) + code size + memory, compared with snapshot restore.

📸

Snapshot restores

After deploy, a memory snapshot is taken. Cold starts become restores, roughly 1.1s → 50ms for Java.

📈

Predictive pre-warm

EWMA arrival rate, a decaying peak memory and measured service time size a warm pool ahead of recurring bursts.

⛔

Quotas and throttling

Tenant token buckets, tenant/function/account concurrency limits, all returning 429 with the reason.

🔒

Real isolation

runIsolated() executes handlers in a fresh node:vm context with a CPU timeout and string code generation disabled.

How it works

From request to result

Deploy

Register a function with runtime, memory, timeout and concurrency. A snapshot of the initialised VM is captured shortly after.

Route

Each invocation passes the tenant rate limiter and three concurrency gates, then looks for a warm idle VM of the current version.

Start

With no warm VM, the orchestrator places a new MicroVM best-fit (evicting LRU idle VMs if needed) and pays a cold or restore start.

Execute

The handler runs with (event, context). Duration is capped by the timeout (504), and exceptions become 500s.

Scale

Every 500ms, keep-alive expiry reclaims idle VMs and the predictor tops up the warm pool from the arrival rate and peaks.

Architecture

System design

Every box is a module in src/. Data flows left to right.

warm hitmissspawnrestorepre-warmrunidleEDGEGatewayinvoke()Quotastoken bucket · 429CONTROLRegistryversions · aliasesPlacementbest-fit · LRU evictPre-warmerEWMA · peaksFLEETWarm poolkeep-aliveMicroVMsboot / restoreSnapshotsmemory imageRUNTIMEIsolatenode:vmMeteringGB-seconds
Use it

Ship it in your own stack

Zero dependencies. Works in Node.js 18+ and modern browsers.

example.js
import { Platform, compile } from "prism-faas";

const p = new Platform({ hosts: 4, hostMem: 8192, keepAlive: 30, snapshots: true });
p.tenant("acme", { concurrency: 100, rps: 500 });

p.deploy({
  name: "resize", tenant: "acme", runtime: "node20", memory: 1024, timeout: 10,
  handler: compile(`function handler(e) { return { body: { ok: true, w: e.w / 2 } } }`),
});

p.invoke("resize", { w: 4000 }, (r) => console.log(r.status, r.kind, r.result));
p.advance(2);                       // virtual seconds
console.log(p.stats, p.percentile(0.99));

// Node: real isolation with a CPU timeout
import { runIsolated } from "prism-faas/src/node/vm-runner.js";
runIsolated(source, { w: 4000 }, { timeoutMs: 500 });
terminal
$ npx github:krishyaa06/prism-faas run examples/resize.js --event '{"width":4000,"height":3000}'
$ npx github:krishyaa06/prism-faas load --rps 120 --seconds 60 --runtime java21
$ npx github:krishyaa06/prism-faas load --no-snapshots --no-prewarm
$ npx github:krishyaa06/prism-faas compare --runtime java21
terminal
# use the CLI without installing
$ npx github:krishyaa06/prism-faas --help

# or add the engine to your project
$ npm install github:krishyaa06/prism-faas

# run the simulator locally
$ git clone https://github.com/krishyaa06/prism-faas.git && cd prism-faas
$ npx serve .   # then open http://localhost:3000