Subchapter 1.7
references/RUNTIME.mdMarkdown3 KBView on GitHub
Deno Deploy uses the standard Deno runtime. You can use JSR and NPM packages, filesystem operations, network requests, subprocesses, and FFI/native addons.
--allow-all)Note: Custom Deno flags cannot be passed to the runtime.
Understanding how your app starts and stops is important for building reliable applications.
Your application starts when a request arrives. If your app crashes before the HTTP server starts, requests return a 502 error.
Tip: Keep startup fast by:
After 5-10 minutes without requests:
SIGINT signalSIGKILL terminates it// Handle graceful shutdown
Deno.addSignalListener("SIGINT", () => {
console.log("Shutting down...");
// Clean up resources, close connections
Deno.exit(0);
});Even during active traffic, instances may be terminated due to:
The system redirects traffic first, then signals shutdown. Long-running connections should expect reconnections.
Cold starts typically complete:
Deno Deploy optimizes cold starts using:
// BAD: Top-level network request delays startup
const config = await fetch("https://api.example.com/config").then((r) =>
r.json()
);
// GOOD: Lazy load on first request
let config: Config | null = null;
async function getConfig() {
if (!config) {
config = await fetch("https://api.example.com/config").then((r) =>
r.json()
);
}
return config;
}| Feature | Status |
|---|---|
| Custom Deno flags | Not supported |
| Persistent filesystem | Use Deno KV instead |
| Long-running background tasks | May be interrupted |
| System tools | Available but may change |