A pool of JS runtime threads that host lightweight contexts.
Each pool thread runs a single JSRuntime that can hold many
JSContext instances. Contexts are ~58 KB to ~429 KB each depending
on API surface (no dedicated OS thread), making it practical to run
thousands concurrently.
Example
# Start a pool with 4 runtime threads
{:ok, pool} = QuickBEAM.ContextPool.start_link(name: MyApp.JSPool, size: 4)
# Create lightweight contexts on it
{:ok, ctx} = QuickBEAM.Context.start_link(pool: MyApp.JSPool)
{:ok, 42} = QuickBEAM.Context.eval(ctx, "40 + 2")Options
:name— registered name for the pool:size— number of runtime threads (default:System.schedulers_online()):memory_limit— maximum JS heap per thread in bytes (default: 256 MB):max_stack_size— maximum JS call stack in bytes (default: 8 MB):max_convert_depth— maximum nesting depth for JS→BEAM value conversion (default: 32):max_convert_nodes— maximum total nodes for JS→BEAM value conversion (default: 10,000)
Summary
Functions
Returns a specification to start this module under a supervisor.
Functions
Returns a specification to start this module under a supervisor.
See Supervisor.
@spec start_link(keyword()) :: GenServer.on_start()