What a worker's :peer is started with, as pure functions (design notes §10.5).
render/3- the configuredenvtemplates for one worker:${NAME}is the controller's value (empty when unset),{worker}the worker index, orbootNfor the boot lane's slot N (bootfor:boot). WithMIX_TEST_PARTITION=_myapp, worker 3 gets_myapp_jg3and boot slot 2_myapp_jgboot2, so eachconfig/test.exsnames its own database;os_env/3- the whole OS environment change:MIX_ENV=test,MIX_DEPS_PATH(the sandbox's dependency mirror), Mix's build-location variables unset (the sandbox has its own_build), then the rendered templates;args/2-erlarguments:+Sschedulers and a-pafor each code path the peer needs before Mix loads the project (Elixir's own applications and Juggernaut's ebin; Mix adds the project's paths);size/2- the pool size within the connection budget.
Summary
Functions
The erl arguments: +S schedulers and -pa for each of paths.
The code paths a peer needs before Mix loads the project.
The OS environment change for a worker's peer, as :peer takes it: charlist pairs,
false to unset.
Database connections one worker is counted for.
The configured templates rendered for worker, with the controller's env.
The pool size: Juggernaut.Config.workers/2, cut down so that every worker's
connections fit the connections budget (budget connections in all,
per_worker each; :auto per worker is twice worker_schedulers, the pool a repo
sized from schedulers_online opens). A budget below one worker is a config error
(exit 2).
Functions
@spec args(pos_integer(), [Path.t()]) :: [charlist()]
The erl arguments: +S schedulers and -pa for each of paths.
@spec code_paths() :: [Path.t()]
The code paths a peer needs before Mix loads the project.
@spec os_env(Path.t(), [{String.t(), String.t()}], keyword()) :: [ {charlist(), charlist() | false} ]
The OS environment change for a worker's peer, as :peer takes it: charlist pairs,
false to unset.
@spec per_worker(Juggernaut.Config.t()) :: pos_integer()
Database connections one worker is counted for.
@spec render( [{String.t(), String.t()}], pos_integer() | :boot | {:boot, pos_integer()}, %{ required(String.t()) => String.t() } ) :: [{String.t(), String.t()}]
The configured templates rendered for worker, with the controller's env.
@spec size(Juggernaut.Config.t(), pos_integer(), non_neg_integer()) :: {:ok, pos_integer()} | {:error, Juggernaut.Error.t()}
The pool size: Juggernaut.Config.workers/2, cut down so that every worker's
connections fit the connections budget (budget connections in all,
per_worker each; :auto per worker is twice worker_schedulers, the pool a repo
sized from schedulers_online opens). A budget below one worker is a config error
(exit 2).
reserve peers' connections are kept out of the budget for peers started beside the
pool (the server's pool keeps one for the boot lane), as long as one worker still fits;
with no budget it changes nothing.