Using Redis Server
- Enterprise IT
Using Redis Server for Session Management on SummitAI on-premise instances, the performance of the Application can be significantly improved.
Prerequisites for Redis Server
Redis is installed on Linux. Ubuntu LTS 18.04 version is the recommended version. The Linux machine can be a physical or a virtual machine. Alternatively, if docker is available on server operating system, Redis can be installed inside docker as well.
You can also install Keydb. Keydb is high performance fork of Redis. Keydb is 100% compatible with Redis. You can switch between Redis or Keydb without altering the code.
Hardware Requirements for Redis Server Installation on Production Systems
Item | Description | Minimum Requirement | Recommended |
RAM Per node | RAM size must be part of the capacity planning | 16GB | >=30GB |
Cores per node | Redis server is based on a multi-tenant architecture and can run multiple processes on the same core without significant performance degradation | 4 cores | >=8 Cores |
Nodes per cluster | At least 3 nodes are required to support a reliable, highly available deployment that handles process failure, node failure, and network split events in a consistent manner. | 3 nodes | >= 3 nodes (Must be an odd number of nodes) |
Ephemeral Storage | Used for storing replication files (RDB format) and cluster log files. | 60GB | 120GB |
Network | Using multiple NICs per node where each NIC is >100Kbps, but RS can also run over a single 1Gbps interface network used for processing application requests, inter-cluster communication, and storage access. | 1G | >=10G |
Software Requirement for Redis Server Installation
Redis Version | Linux |
2.8.x | Ubuntu LTS 18.04 version |
Redis Installation on VM or Physical Machine
- Update your local apt package cache and install Redis by typing in:
- sudo apt update
- sudo apt install redis-server
- This will download and install Redis and its dependencies. Redis configuration can be managed using redis.conf file. Default password for Redis is empty. Open the redis conf by issuing the following command
- sudo nano /etc/redis/redis.conf
To start the Redis Server automatically, it has to register with system. Update the Redis conf with following:
supervised system
To check the if Redis service is running fine, issue the following command:
sudo systemctl status redis
By default, Redis service runs on 6379 port. You can change this port by editing the redis.conf file. More about Redis configuration can be found in the following links:
https://redis.io/topics/config
https://raw.githubusercontent.com/antirez/redis/5.0/redis.conf
Redis Installation in Docker
Make sure that the docker is installed on the server grade operating system. Run the following command:
docker pull redis
It will pull the latest version of Redis. To install specific version, issue the following command:
docker pull redis:{specific version}Run the container using following command:
docker run -p 6379:6379 -d redis
The Docker port of 6379 is mapped with 6379 of local machine. Make sure that 6379 port is open for other machines. Port 6379 of Redis machine should be accessible from the Application Server.
Configuring SummitAI Application for Using Redis for Session Management
Redis connection string and web.config changes
- Remove existing session provider from web.config. E.g. remove state server or SQLserver
- Add the following settings in under <system.webserver> section
<modules>
<remove name="Session" />
<add name="Session" type="Microsoft.AspNet.SessionState.SessionStateModuleAsync, Microsoft.AspNet.SessionState.SessionStateModule, Version=1.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" preCondition="integratedMode" />
</modules>
- Add the Redis provider by adding following settings:
Refer to sample web.config For Redis
<sessionState mode="Custom" customProvider="MySessionStateStore">
<providers>
<!-- Either use 'connectionString' OR 'settingsClassName' and 'settingsMethodName' OR use 'host','port','accessKey','ssl','connectionTimeoutInMilliseconds' and 'operationTimeoutInMilliseconds'. -->
<!-- 'throwOnError','retryTimeoutInMilliseconds','databaseId' and 'applicationName' can be used with both options. -->
<!--
<add name="MySessionStateStore"
host = "127.0.0.1" [String]
port = "" [number]
accessKey = "" [String]
ssl = "false" [true|false]
throwOnError = "true" [true|false]
retryTimeoutInMilliseconds = "5000" [number]
databaseId = "0" [number]
applicationName = "" [String]
connectionTimeoutInMilliseconds = "5000" [number]
operationTimeoutInMilliseconds = "1000" [number]
connectionString = "<Valid StackExchange.Redis connection string>" [String]
settingsClassName = "<Assembly qualified class name that contains settings method specified below. Which basically return 'connectionString' value>" [String]
settingsMethodName = "<Settings method should be defined in settingsClass. It should be public, static, does not take any parameters and should have a return type of 'String', which is basically 'connectionString' value.>" [String]
loggingClassName = "<Assembly qualified class name that contains logging method specified below>" [String]
loggingMethodName = "<Logging method should be defined in loggingClass. It should be public, static, does not take any parameters and should have a return type of System.IO.TextWriter.>" [String]
redisSerializerType = "<Assembly qualified class name that implements Microsoft.Web.Redis.ISerializer>" [String]
/>
-->
<add name="MySessionStateStore" type="Microsoft.Web.Redis.RedisSessionStateProvider"
host=""
accessKey=""
ssl="true" />
</providers>
</sessionState>
Redis Clients
Redis Cli
This is a free command line tool and comes with Redis installation. No separate installation is required for this.
Redis Commander
This is a free and open source browser-based GUI tool.
Installation Using npm
Run the following command for installation:
npm install -g redis-commander
Launch the Redis commander from command prompt using the following command:
redis-commander
Open the browser and browse the following URL: http://127.0.0.1:8081
Add the Redis Server using Add Server menu. Enter the Redis Server details for connecting it.
Please refer following link for more details: Redis-commander installation
Redis Insights
This is paid browser-based GUI client. Free version has many limitations. Download the application from the following link: Download Redis Insights
After installation, launch the Redis Insights from the Start menu. Open the browser and enter the following URL: http://localhost:8001/
You can add Redis connection from the UI.
Confluence Cloud Migration Alert: Please refer to known issues you may encounter in Confluence Cloud: https://eitdocs.atlassian.net/wiki/x/wDGwAQ