One of the things that’s so great about Redis is how well it can complement and extend other databases in your ecosystem. While replacing legacy backend databases with newer ones is often seen as expensive and risky, they don’t easily scale in the linear fashion required for users’ ‘instant experience’ expectations.
Some of the things that make it difficult to accommodate modern application needs using a traditional MySQL architecture are:
- Read/write speeds of traditional databases are not good enough for use cases such as session stores.
- Introducing new tables or modifying an existing schema can be extremely complex, which makes adding new features and applications extremely difficult.
- Legacy databases are limited by the number of operations you can perform per second and by the number of concurrent connections you can have. As a result, you end up having to invest in more database instances – increasing your infrastructure and maintenance costs.
On the other hand, in-memory databases like Redis can help you future-proof and increase the value of your investment. For instance, if your application stores data in MySQL or any other relational database, you can easily insert Redis as a front-end database in between the application and MySQL. By designing look-aside and write-through caching solutions, session stores and rate-limiters with Redis, you’ll boost performance, speed innovation, scale with fewer resources and ultimately deliver the best experience for your users.
Redis as a ‘System of Engagement’
Redis’ in-memory key-value data store can deliver low latency responses for your users because it’s extremely fast and flexible, and includes built-in data structures (e.g. Lists, Hashes, Sets, Sorted Sets, Bitmaps, Hyperloglog, and Geospatial Indices) that perform some data operations more efficiently and effectively than relational databases. We recommend using Redis behind the data access layer as a ‘system of engagement’ to store the hot data users engage with, while designating your MySQL as the ‘system of record.’
To avoid creating a bottleneck in their application, database or network layers, many developers use Redis for the following use cases:
- Cache: This provides a tiered model for memory access, in which applications store common, repeatedly read objects in Redis. Caching helps applications retrieve data quickly and limit the load on the database server.
- Session Store: In all interactive apps, the server maintains a unique session for each active user. Rather than relying on MySQL-like relational databases to persist session data, a single cluster of Redis on decently sized servers with sufficient RAM can manage thousands, if not millions of sessions.
- Real-time Analytics: Gamification through leaderboards, dashboards, polls, messages, counters and other real-time aggregators require constant processing and communication with end-users. Redis’ powerful and highly efficient data structures enable you to collect, process and dissipate millions of simultaneous activities or objects to thousands of active users in real time.
- Metering: Redis can also help developers cost-effectively manage the load on legacy servers during peak usage times by rate limiting the number of calls applications make every few seconds.
In addition to the examples above, Redis can be used as a message broker, data structure store and temporary data store for a variety of use cases. Essentially, Redis gets your data closer and faster to your end user, while collecting their data more quickly. Taking things to the next level, Redis Enterprise offers high availability, in-memory replication, auto-scaling and re-sharding, along with leading-edge CRDT-based active-active support for distributed databases and built-in Redis modules such as RediSearch, ReJSON, Rebloom and Redis Graph.
Thanks to this powerful database, today’s ‘instant experience’ demands can be met without ripping out your legacy solutions. Using a bit of creativity, you can instead leverage Redis to balance the need for business continuity and time-to-market with the benefits of superior performance, flexibility, extensibility and scalability.