Redis and Redis applications

Tram Ho

What is redis

  • Redis stands for Remote Dictionary Server, is a key-value data storage in RAM. IT is an open source with fast access speed used as a database, caching, message forwarding and saving to-do list.
  • Redis provides response time at less than a millisecond, helping to make millions of requests per second for real-time applications.
  • Redis is often used for caching, session management, games, rankings, real-time analysis, etc.

How Redis works

  • All Redis data is in memory, as opposed to the normal database that stores data on the drive. By eliminating the need for disk access, memory data stores such as Redis avoid delays due to searching time and can access data in microseconds. Redis has a flexible data structure, high availability, data on RAM, support for storage on disks and clusters, helping to build large-scale applications in real time.

New feature of Redis 5.

  • Redis 5. * is currently the latest GA version of Redis. Since its initial release in 2009, from a caching technology, Redis has evolved into a fast and easy-to-use in-memory data store, providing flexible data structures and response in less than 1 millisecond. Redis has reached a milestone with version 5.0, which has various improvements and improvements. What is remarkable here is the launch of Streams, the completely new data structure in Redis. This release also adds commands for sorted data sets and new capabilities for module APIs.

Redis benefits

  • Data warehouse in memory
    • All of the Redis data is located in the server’s main memory, as opposed to the normal database, most of the tasks require reciprocating access to the drive, the data store in the memory as Redis does not take time. space for disk access, so this data warehouse can support quite a lot of tasks and have faster response times. The result is noticeable fast performance with common read or write tasks, supporting millions of operations per second.
  • Flexible data structure
    • String: text or binary data up to 512MB in size
    • List: a collection of Strings arranged in the same order as they were added.
    • Set: unordered set.
    • ZSet: set is sorted by value.
    • Hash: data structure used to store lists by key-values.
    • Bitmap: data type that allows to perform bit scale tasks.
    • HyperLogLogs: probability data structures to estimate unique components in a dataset.
  • simple and easy to use
    • Redis simplifies by allowing you to write fewer lines of code to store, access, and use data on applications. For example, if your application has data stored in a hash array and you want to store that data in a data warehouse, you simply need to use the Redis hash data structure. The same task on a data warehouse without a hash data structure will require multiple lines of code to convert from one format to another. Redis is equipped with its own data structure and many options to control and interact with your data. There are many languages ​​that support Redis such as Java, Python, PHP, JavaScript, Nodejs …
  • Replication and durability
    • Redis uses the Master-Slave edition architecture and supports asynchronous replication which can copy data to multiple replica servers. This results in higher read performance because it is possible to separate requests between servers and the recovery speed is faster when the server goes down. About durability Redis supports backing up to a drive at a time.
  • Ability of extension
    • Redis is an open source project supported by a large community. There is no vendor or technology limit as Redis has open standards, supports open data formats, and a set of servers.

Common use cases of Redis

  • Cache storage: Redis is a great option to deploy a high-availability in-memory cache to reduce data access latency, increase performance, and reduce the load on relational databases and application. Redis can serve the frequently requested data and easily scale to meet the high load without the need for backend improvements at a lower cost. Some examples of caching such as database query results, frequently used objects, etc.
  • Chat, messaging and task list: Redis with Pub / Sub mechanism is a structure of sending and receiving messages in Redis that allows Redis to support high performance chat rooms in real time. The data structure makes it easy to deploy a list of tasks that need to be handled with light weight.
  • Game rankings: Redis is a good solution used by game developers to build rankings in real time. Just using the ZSET data structure this structure ensures the uniqueness of the components while maintaining the list sorted by the user’s score. Creating a real-time ranking list is easy to follow when updating the score.
  • Session storage: Redis is a highly reliable and durable in-memory data warehouse used to store and manage sessions for internet applications. Redis has low latency, scale, and elasticity needed to manage session data such as login information, session status.
  • Distributed data content: Redis provides in-memory storage, with fast access speeds for direct use. Redis can be used to store user data, view history, authentication tokens / tokens for millions of users, and display files that can be transferred at content to mobile users, computers table at the same time.
  • Data coordinates: Redis integrated to manage geographic data in real time at the desired scale and speed. Commands such as GEOADD, GEODIST, GEORADIUS, and GEORADIUSMEMBER for geographic storage, processing, and analysis make it easier to register geographic data.
  • Machine Learning: Data-driven applications require machine learning to be able to quickly process large, varied, high-speed and automated data. Redis provides memory storage, fast speed to access, train and deploy machine learning models quickly.
  • Real-time analysis: Use Redis in combination with online solutions such as Apache Kafka and Amazon Kinesis as an in-memory data warehouse to consume, process and analyze real-time data. Redis is the ideal choice for real-time analytics usage cases like social networks, IoT.


Share the news now

Source : Viblo