Redis Sizing Guidelines

Redis stores two types of data: Application state and User state.

Application state typically can take up a few MB and is not a factor when making sizing considerations. Session state grows linearly with the number of concurrent Users in your system. Since Redis stores session data for the duration of active sessions, if you have session duration set to 90 minutes, at any given point in time, Redis stores session for any User with activity in the last 90 minutes.

As a best practice, calculate how much Redis memory you need by figuring out the maximum number of Users in any time window equivalent to a session duration, and then multiply it by 10 MB. That covers in the majority of the cases. If this proves to be insufficient, proceed with the process below in order to measure actual memory consumption

The size needed for each system can vary depending on your content and the particular page and activity Users are performing. Measure your own specific load in order to estimate the sizing numbers. Use the measurements below to calculate what kind of Redis memory your Cherwell Server Farm requires; and, if necessary, increase the memory of your server.

To measure sizing numbers:
  • For the purposes of sizing Redis, set up a farm with a single server.
  • Load into the system with 10 Users, and then measure the load in Redis.
  • Load into the system with 20 Users, and then measure the load in Redis.
  • Load into the system with 100 Users, and then measure the load in Redis.

With the data points, compute the average Redis load per User expressed in Kb. Multiply that number by the peak (or total) number of Users..

Retrieving the Size of Redis Memory

When Redis is installed, it is easy to open a client window and send Redis commands. One of those commands is INFO, which shows the current memory size occupied by the Redis database. The sample output of the command shows the peak usage of Redis. This is the number needed to calculate how much memory each User needs.

Current Sizing Limitations

There are some physical limits to the number of Users that can be supported based on the current configuration:

  • Physical memory on a machine: Adding memory to a machine should be easy. It is common to have servers with hundreds of GB or even 2TB of data. Assuming a single User footprint of 4MB, that means being able to support 10,000 concurrent Users with 40GB of RAM.
  • Network traffic: Once the RAM is sized, your next concern is throughput. The calculation would be similar to the table below (input rows are indicated, others are calculated).

Organizational specifics for sizing can vary depending on the assumptions made. Generally, based on the common numbers expect 10,000 Users to require 10 GIG+ per second to go through a network. These numbers are only the Redis traffic. Web and SQL traffic also increases the number. The increase happens in such a way that it is impossible to project, but should be fairly easy to find if metrics are run on the network. As Redis becomes the bottleneck, performance needs to be addressed across the board.

The calculations in the table below are based on default Cherwell Server Farm settings.

The example calculations below are from proven averages.

Example: For every page, you need to read from Redis an average of four times, and to figure out the actual traffic you have to double that (every time there is a read, there must be a write). The following table gives an idea of how to calculate the traffic:

Calculating Redis Network Traffic
Input:Clicks per User per minute 2 How many times per minute does an average User click a button or a link? Once every 30 second is a good average between active Users and Users that wait between performing actions (or that just leave their browser open without even looking at it).
Input:Users 10,000 What is a reasonable peak of maximum concurrent Users? The number of concurrent Users that are using the system.
Input:Redis reads per click 4 Reads per click: Every time a User clicks a button, something happens. It can navigate from one page to another, or save an object being. Depending on content, the Browser Client is rendering a page that might make a number of changes.
Input:Redis Writes per click 4 This varies depending on content and the page the User is on.
Redis requests per minute 160,000 Calculated = Clicks x Users x (Reads + Writes)
Input:State size per User in MB 4 Varies depending on the content and the page that the User is on.
Redis Network Traffic per minute in MB 640,000 Calculated = Requests per minute x 4
Requests per second 2,667 Calculated = Requests per minute/60
Redis traffic per second in MB 10,667 Calculated = Traffic per minute/60