You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
document environment variables and increase code cache default
- Document all 13 env vars in README, organized by category
- Add V8_EXECUTE mode explanations (PINNED, POOLED, ONESHOT)
- Increase SNAPSHOT_CACHE_MAX default from 500 to 5000
|`V8_EXECUTE`|`PINNED`| Execution mode: `PINNED`, `POOLED`, or `ONESHOT`|
75
+
|`SNAPSHOT_CACHE_MAX`|`5000`| Max entries in the in-memory code cache LRU |
76
+
|`WORKER_POOL_SIZE`| CPU cores | Number of V8 worker threads |
77
+
|`MAX_QUEUED_WORKERS`| pool × 10 | Max queued tasks before backpressure |
78
+
|`WORKER_WAIT_TIMEOUT_MS`|`10000`| Timeout (ms) waiting for a worker slot |
79
+
80
+
`V8_EXECUTE` modes:
81
+
82
+
##### `PINNED` (default)
83
+
84
+
Thread-local isolate pools — each thread maintains its own pool of V8 isolates, keyed by tenant (`user_id`). Zero cross-thread contention. Multiple isolates can exist per tenant for concurrent requests. Includes backpressure via per-thread queue with configurable size and timeout.
85
+
86
+
A new V8 context is created per request, so no JS state leaks between requests. The isolate (engine, heap, GC) is reused to avoid the allocation cost.
87
+
88
+
##### `POOLED`
89
+
90
+
Single global LRU pool shared across all threads, protected by a mutex. Isolates are keyed by `worker_id`. Simpler model but higher contention under load since all threads compete for the same lock.
91
+
92
+
##### `ONESHOT`
93
+
94
+
Fresh V8 isolate per request, destroyed after each response. No reuse, no pooling. Slower (~1-2ms overhead per request) but useful for debugging. Also serves as a workaround for a V8 SIGSEGV (`SEGV_PKUERR`) that affects PINNED and POOLED modes in some containerized environments (see [#2](https://github.com/openworkers/openworkers-runner/issues/2)).
0 commit comments