Sticky sessions
We support session persistence (AKA sticky sessions) with a customizable TTL, defaulting to 15 minutes.
Using sticky sessions
Key | Value | TTL | Examples |
---|---|---|---|
session | Any unique identifier of up to 255 characters (regardless of character encoding); Massive will make best efforts to route requests in the same session to the same egress node | Default: 15 minutes (customizable with `sessionttl`) | session42, 1234 |
sessionttl | Customizable session TTL in minutes, up to 60 minutes | Default: 15 minutes | 30, 60 |
You can inject a session identifier, like a unique representation of your app or active task, to specify that multiple requests should originate from a single egress node (if available):
- Session TTL defaults to 15 minutes but can be customized using the
sessionttl
parameter. For example, to set the TTL to 30 minutes:
-
When a session identifier is specified and found the server will perform a request via the same node unless:
-
TTL is expired.
-
The request limit per minute for the node is exceeded.
-
The node has gone offline.
-
-
If the session identifier is not found or the conditions above are not met, a new session is created with the specified ID and attached to the new node.Additional parameters
Key | Value |
---|---|
sessionmode | strict , flex |
By default, when a sticky session fails, our algorithm attempts to find a new node to complete the request, attaching a new IP address to the sticky session. This behavior can be overwritten by specifying sessionmode-flex
.
Example of using undefined sessionmode
, which defaults to sessionmode-strict
:
Example with sessionmode-strict
explicitly defined:
Alternatively, a sticky session can persist through an error by using sessionmode-flex
, though this may increase error rate.
Attention: The max number of errors is 15 until a new node is assigned to a sticky session.
Example with sessionmode-flex
:
Known issues
When session
is specified without geotargeting or use of one of our regional endpoints, the request may get cross routed, causing different IPs to be called during a sticky session depending on which server handles the request.
Workarounds:
- Use regional endpoints https://us-network.joinmassive.com/ or https://eu-network.joinmassive.com/
- Use geotargeting