Overview
Redis is an in-memory database that persists on disk and open source. The data model is key-value format wherein the value could be any data structure such as string, list, bitmap, hashes, sets etc. It supports NoSQL Database and can be used as Cache or Message Broker in a Single Server or Multi-Server environment.
In case of a Multi-Server scenario, Redis is installed on multiple servers to build a Master-Slave environment wherein one Redis Server would act as the Master and rest of them would act as Slaves. Thus, there is an out-of-the-box support available to support Master-Slave asynchronous replication along with high availability of a server through Redis Sentinel component.
Some other noted features of Redis include:
- Lua Scripting
- LRU (Less Recently Used) Eviction
- Transactions
- Disk Persistence
- Automatic Failover
- Publisher-Subscriber Support
Why Redis on Windows?
Earlier, Microsoft had launched Microsoft AppFabric for caching capabilities for Web Applications as well as Middle-tier Services. However, after the MSAppFabric 1.1 release, Microsoft announced the discontinuation of support for MS AppFabric and are now encouraging the use of Redis for caching features.
For Cloud-based solutions the recommendation is to use Microsoft Azure Redis Cache whereas for On-Premise solutions Redis on Windows is recommended.
Compatible Operating Systems
Redis is essentially developed and most lytested in Linux and OS X Operating Systems. It is made to be deployable in Linux based Operating Systems. Although there is no official support for Redison Windows OS by Redis community (www.redislabs.com), Microsoft develops and maintains Win-64 RedisServer component. This series mainly talks about the Redison Windows.
Microsoft officially supports only 64-bit version of Redis although one can build the 32-bit version using the Source Code.
The above URL also explains how to build the 32-bit version using Visual Studio 2013.
(When I tried building the code using Visual Studio 2013 for 32-bit version, I ended-up with compilation errors. They are essentially because of the late variable declarations in C files unlike the legacy style of upfront declaration. However, upon removing the compilation errors it successfully builds the components that can be deployed using command-line!).
Installing Redis as a Service
Windows Redis version 2.8.9 has support to make the Redis Component installed as a Windows Service on a dedicated port. Redis clients can connect to the Server using the dedicated port.
When Redis is installed using the MSI package, it is by default installed as a Windows service. It provides a configuration file called "redis.windows-service.conf" in order to change its settings. Upon restarting the service from services.msc the changed settings will come into effect. During installation of the MSI package the installer’s user interface can be used to changethe port at which Redis has to listen. Redis can also be installed using command line.
As far as the Redis Service configuration is concerned, the configuration file viz. "redis.windows-service.conf” is very descriptive with respect to each and every configuration element in it!
Redis Clients
There have been various RedisClient components for .Net Languages available in NuGet Gallery:
- ServiceStackRedis (According to me, one might find difference in performance between Free and Paid License version. Free version was found breaking in multi-user scenarios.).
- StackExchangeRedis (Showcased by Microsoft in many examples. I found it robust in multi-user, heavy-load scenarios).
- C# Redis Client for the RedisNoSQL Database.
- Redis.Cache.
And many more.
Summary
Redis is a very popular open-source, networked, in-memory, key-value data store and known for high performance, it is promoted by Microsoft to replace erstwhile AppFabric. MS Open Tech has been working closely with the Redis community to build a production-ready Windows port of Redis, including 64-bit support, an installer for Windows Azure, NuGet support and much more. The time has come to embrace Redis and get acquainted with the features provided by it.
In subsequent articles, let’s focus on the following aspects of On-Premise Redis:
- Redis Server Installation & Configuration.
- Accessing Server using a Redis Client& Data Caching.
- Data Replication &Redis Sentinel for Automatic Failover in multi-server scenario.
Read more articles in Redis: