📈Scaling SSX Server
Learn why and how to use session storage to scale your server's authentication mechanism
Last updated
Learn why and how to use session storage to scale your server's authentication mechanism
Last updated
Interested in the code? Jump to an example scaling with Redis and SSX below!
Horizontal scaling is a type of scaling in which an application is scaled by adding more servers to the system, as opposed to increasing the power of a single server. This type of scaling is often used in web apps where the load on the system (incoming requests) can be divided among multiple servers.
Some benefits of horizontal scaling include:
Increased scalability: When an application is horizontally scaled, it can handle a larger number of requests because there are more servers available to process them.
Improved reliability: If one server in a horizontally scaled system goes down, there are still other servers that can handle the load. This can help to improve the overall reliability of the system.
Reduced costs: Horizontal scaling can be more cost-effective than vertical scaling because it often requires less hardware. When more servers are added to a system, each server can handle a smaller portion of the load, which can lead to lower costs.
A shared session store allows you to share session data across multiple servers. This is important when you are scaling horizontally because it allows you to share session data between servers. This means that if a user logs in on one server, their session data will be available on all of the other servers. This makes it easier to manage session data and ensures that all of the servers have the same data.
As part of handling end-to-end authentication, SSX makes it simple to scale by providing many compatible ways to configure your session store on Express, Connect or Node http servers.
Keeping state of the session lets a system allow users to maintain and invalidate active sessions instead of issuing a session token that will be active until it is expired. Giving users this ability is important from a user security perspective (e.g. a user can log out of all devices if a device is compromised).
SSX comes with a default session manager that lives in memory. This is not advised for production use, as this store is volatile (if the server restarts, all data in the session store will be lost) and not scalable (other server instances cannot access this server's memory). We recommend using a compatible session store like Redis.