Updated on 2024-01-22 GMT+08:00

Configuring a Distributed Cache

Traditional single-instance applications use local session management. Session contexts generated by user requests are stored in the process memory. After the load balancing module is added, multi-instance sessions need to be shared using distributed storage.

ServiceStage provides the out-of-the-box distributed session function. It uses the Distributed Cache Service as the session persistence layer. Without code modification, ServiceStage supports distributed session management for Tomcat applications, Node.js applications that use express-session, and PHP applications that use session handle.

During component deployment, you can bind the distributed cache when configuring Advanced Settings.

Prerequisites

A distributed cache has been created. For details, see Creating a DCS Redis Instance.

Procedure

  1. Choose Advanced Settings > Distributed Cache.
  2. Click Bind Distributed Cache.
  3. Select a distributed cache instance that has been bound in the environment.

    If no distributed cache instance is bound to the environment, click Add One. On the Edit Environment page that is displayed, click Add Optional Resource to add created DCS resources to the environment.

  4. If the DCS instance must be accessed using a password, enter the access password.
  5. Click OK.