Estimating memory and storage requirements for session state

Current version: 10.4

Sitecore stores session states in memory or in databases before moving them to xDB. You must estimate your session state memory and disk storage requirements before deploying your Content Delivery instances and session state database servers.

The formula to estimate your session state storage requirements in MB is New sessions per second * Session duration in seconds * Session state size in kB / 1024. For example, you can configure 44 MB (1.42 * 1560 * 20 / 1024) of private session state storage with the following values:

  • New sessions per second: (10 / 7) = 1.42

    • Requests per second: 10

    • Page views per session: 7

  • Session duration in seconds: (5 + 20 + 1 minutes) * 60 seconds = 1560

    • Visitor's active period: 5 minutes

    • The session timeout: 20 minutes

    • The session end overhead: 1 minute

  • Session state size in kB: 20 (with shared sessions enabled).

The following table describes the metrics used:

Metric

Description

New sessions per second

Requests per second / page views per session.

Requests per second

The average number of HTTP requests per second to your website.

You get this value from the ASP.NET performance counters.

Page views per session

The average number of HTTP requests in a session.

You get this value from the xDB.

Session duration in seconds

The estimated number of seconds that the session state exists in the session state store.

You get this value by adding the following values:

  • Visitor's active period, which is the average difference between the StartDateTime and EndDateTime properties of the xDB interaction records.

  • Session timeout, which is defined in your ASP.NET configuration.

  • Session end overhead, which is the average time it takes for Sitecore to process an expired session and to remove it from the session state store. This value typically does not exceed 60 seconds.

Note

Shared sessions tend to be longer than private sessions because multiple visits from the same contact overlap in the shared session state object. For a typical website, the number of concurrent shared sessions is equal to or slightly less than the number of concurrent private sessions.

Session state size in kB

The estimated size of a single session state.

In a default Sitecore installation with shared sessions disabled, the approximate state size is 35 kB for private sessions, and the size increases during the session.

If you enable shared sessions, the approximate state sizes are 20 kB for private sessions and 15 kB for shared sessions.

Tip

You can enable shared session state store with a patch file.

You can evaluate the session state size from the Redis console. Make sure that the session state store is empty (KEYS * command must return 0 keys), perform a regular user journey through the website, and return to the Redis console and check all the key sizes with the MEMORY USAGE command.

The shared session state storage requirements depends on the number of contacts visiting the website at a particular time and how many customizations you have implemented. For example, you must configure more shared session storage if you have custom contact facets populated with data or if you want to load a contact's visit history for personalization.

Do you have some feedback for us?

If you have suggestions for improving this article,