To ensure stability of stateful applications, load balancers implement persistence which directs all related connections to the same server. Different types of persistence are supported to address different types of application needs.

Some applications maintain the server state such as, shopping carts. Such state might be per client and identified by the client IP address or per HTTP session. Applications might access or modify this state while processing subsequent related connections from the same client or HTTP session.

Source IP persistence profile tracks sessions based on the source IP address. When a client requests a connection to a virtual server that enables the source address persistence, the load balancer checks if that client was previously connected, if so, returns the client to the same server. If not, you can select a server pool member based on the pool load balancing algorithm. Source IP persistence profile is used by Layer 4 and Layer 7 virtual servers.

Cookie persistence profile inserts a unique cookie to identify the session the first time a client accesses the site. The HTTP cookie is forwarded by the client in subsequent requests and the load balancer uses that information to provide the cookie persistence. Cookie persistence profile can only be used by Layer 7 virtual servers. Note that blank space in a cookie name is not supported.

Prerequisites

Verify that Manager mode is selected in the NSX Manager user interface. See NSX Manager. If you do not see the Policy and Manager mode buttons, see Configure User Interface Settings.

Procedure

  1. From your browser, log in with admin privileges to an NSX Manager at https://<nsx-manager-ip-address>.
  2. Select Networking > Load Balancing > Profiles > Persistence Profiles.
  3. Create a Source IP persistence profile.
    1. Select Add > Source IP Persistence from the drop-down menu.
    2. Enter a name and a description for the Source IP persistence profile.
    3. Complete the persistence profile details.
      You can also accept the default Source IP profile settings.
      Option Description
      Share Persistence Toggle the button to share the persistence so that all virtual servers this profile is associated with can share the persistence table.

      If persistence sharing is not enabled in the Source IP persistence profile associated to a virtual server, each virtual server that the profile is associated to maintain a private persistence table.

      Persistence Entry Timeout Enter the persistence expiration time in seconds.

      The load balancer persistence table maintains entries to record that client requests are directed to the same server.

      • If no new connection requests are received from the same client within the timeout period, the persistence entry expires and is deleted.
      • If a new connection request from the same client is received within the timeout period, the timer is reset, and the client request is sent to a sticky pool member.

      After the timeout period has expired, new connection requests are sent to a server allocated by the load balancing algorithm. For the L7 load balancing TCP source IP persistence scenario, the persistence entry times out if no new TCP connections are made for some time, even if the existing connections are still alive.

      HA Persistence Mirroring Toggle the button to synchronize persistence entries to the HA peer.
      Purge Entries When Full Purge entries when the persistence table is full.

      A large timeout value might lead to the persistence table quickly filling up when the traffic is heavy. When the persistence table fills up, the oldest entry is deleted to accept the newest entry.

    4. Click OK.
  4. Create a Cookie persistence profile.
    1. Select Add > Cookie Persistence from the drop-down menu.
    2. Enter a name and a description for the Cookie persistence profile.
    3. Toggle the Share Persistence button to share persistence across multiple virtual servers that are associated to the same pool members.

      The Cookie persistence profile inserts a cookie with the format, <name>.<profile-id>.<pool-id>.

      If the persistence shared is not enabled in the Cookie persistence profile associated with a virtual server, the private Cookie persistence for each virtual server is used and is qualified by the pool member. The load balancer inserts a cookie with the format, <name>.<virtual_server_id>.<pool_id>.
    4. Click Next.
    5. Complete the persistence profile details.
      Option Description
      Cookie Mode Select a mode from the drop-down menu.
      • INSERT - Adds a unique cookie to identify the session.
      • PREFIX - Appends to the existing HTTP cookie information.
      • REWRITE - Rewrites the existing HTTP cookie information.
      Cookie Name Enter the cookie name. A blank space in a cookie name is not supported.
      Cookie Domain Enter the domain name.

      HTTP cookie domain can be configured only in the INSERT mode.

      Cookie Path Enter the cookie URL path.

      HTTP cookie path can be set only in the INSERT mode.

      Cookie Garbling Encrypt the cookie server IP address and port information.

      Toggle the button to disable encryption. When garbling is disabled, the cookie server IP address and port information is in a plain text.

      Cookie Fallback Select a new server to handle a client request if the cookie points to a server that is in a DISABLED or is in a DOWN state.

      Toggle the button so that the client request is rejected if cookie points to a server that is in a DISABLED or is in a DOWN state.

    6. Complete the Cookie expiry details.
      Option Description
      Cookie Time Type Select a cookie time type from the drop-down menu.

      Session Cookie is not stored and will be lost when the browser is closed.

      Persistence Cookie is stored by the browser and is not lost when the browser is closed.

      Maximum Idle Time Enter the time in seconds that a cookie can be idle before it expires.
      Maximum Cookie Age For Session Cookie only. Enter the maximum age in seconds that a cookie can be active.
    7. Click Finish.