asFollower()
function asFollower(service, leader): AnySkipService
Run a SkipService as a follower in a leader-follower topology.
Instead of running a service on one machine, it can be distributed across multiple in a leader-follower architecture, with one "leader" maintaining the shared computation graph and one or more "followers" across which client-requested resource instances are distributed.
The two kinds of shared collection are obtained differently. Eager collections, named in collections, are mirrored from the leader: the leader maintains them and streams their updates to the follower. Lazy collections cannot be mirrored, since they hold no maintained state to stream; each is instead rebuilt locally by the follower, lazies mapping its shared name to a function which, given the follower's Context, produces the corresponding lazy collection. Together, the two are expected to cover the ResourceInputs of service.
Parameters
| Parameter | Type |
|---|---|
service | AnySkipService |
leader | { collections: string[]; lazies: {}; leader: { control_port: number; host: string; streaming_port: number; }; } |
leader.collections | string[] |
leader.lazies? | {} |
leader.leader | { control_port: number; host: string; streaming_port: number; } |
leader.leader.control_port | number |
leader.leader.host | string |
leader.leader.streaming_port | number |
Returns
AnySkipService
The follower component to run service in such a configuration.