HarperFast / HarperFast/harper-pro
Multi-tenant within process: SNI-based instance routing with isolated workers
- Dominant language
- JavaScript
- Stars
- 3
- Forks
- 0
- Avg merge
- 1d 21h
- Merged PRs (30d)
- 80
Description
## Overview
Support running multiple tenant instances within a single HarperDB process, with scale-to-zero capability for large numbers of low-usage accounts.
## Architecture
**Without user code:** Delegate to separate instances via SNI/Host routing with separate components and server interfaces per instance.
**With user code:** Dedicated workers per instance. Worker pool starts in "uncommitted available" state (modules loaded, no specific instance yet). On incoming connection:
1. Router checks SNI/Host → determines target instance
2. Routes to existing committed workers, or picks an uncommitted one
3. Uncommitted worker loads the instance's components/database → becomes committed
4. A new uncommitted worker is spun up to replenish the pool
**Lifecycle:** Workers have a minimum run time. After idle time expires, they unref servers and exit gracefully. New uncommitted workers replace them.
**Isolation:** JS sandboxing + V8 Isolate per worker prevents cross-instance data access.
🤖 Filed by Claude on behalf of Kris.
Contributor guide
Assessment
This issue has not been assessed yet.