Skip to content

Strategies does not scale well #613

@JSteunou

Description

@JSteunou

In case of multiple node services, scaled horizontally, passport use (which register a Strategy by name) and authenticate (which get back a Strategy previously registered by name) do not scale well because all the nodes would not shared the same private _strategies store object.

You can have one request initiated on a node but ended on another node for the sso callback when having load balancing and those can have different Strategy configuration for the same name. This can happen when you update your Strategies configuration but restart your node one by one for a high quality of service.

A better way to handle this is to recreate the Strategy for each request and never rely on a store object (so no cache), but the authenticate method get in the way because it only rely on the _strategies internal store See https://github.com/jaredhanson/passport/blob/master/lib/authenticator.js#L463

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions