Software:Redis

From HandWiki
Short description: Open-source in-memory key–value database
Redis
Redis Logo.svg
Original author(s)Salvatore Sanfilippo[1][2]
Developer(s)Redis[1][2]
Initial releaseMay 10, 2009; 14 years ago (2009-05-10)
Written inC
Operating systemUnix-like[3]
Available inEnglish
TypeData structure store, key–value database
LicenseBSD 3-clause[4]

Redis (/ˈrɛdɪs/;[5][6] Remote Dictionary Server)[5] is an open-source in-memory storage, used as a distributed, in-memory key–value database, cache and message broker, with optional durability.[7] Because it holds all data in memory and because of its design, Redis offers low-latency reads and writes, making it particularly suitable for use cases that require a cache. Redis is the most popular NoSQL database,[8][9][10] and one of the most popular databases overall.[11] Redis is used in companies like Twitter,[12][13] Airbnb,[14] Tinder,[15] Yahoo,[16] Adobe,[17] Hulu,[18] Amazon[19] and OpenAI.[20]

Redis supports different kinds of abstract data structures, such as strings, lists, maps, sets, sorted sets, HyperLogLogs, bitmaps, streams, and spatial indices.

The project was developed and maintained by Salvatore Sanfilippo, starting in 2009.[21] From 2015 until 2020, he led a project core team sponsored by Redis Labs.[22] Salvatore Sanfilippo left Redis as the maintainer in 2020.[23] In 2021 Redis Labs dropped the Labs from its name and now is known simply as "Redis".[24]

Redis is released under a BSD 3-clause license.[4]

History

Salvatore Sanfilippo, the original developer of Redis (photo taken in 2015)

The name Redis means Remote Dictionary Server.[5] The Redis project began when Salvatore Sanfilippo, nicknamed antirez, the original developer of Redis, was trying to improve the scalability of his Italian startup, developing a real-time web log analyzer. After encountering significant problems in scaling some types of workloads using traditional database systems, Sanfilippo began in 2009 to prototype a first proof of concept version of Redis in Tcl.[25] Later Sanfilippo translated that prototype to the C language and implemented the first data type, the list. After a few weeks of using the project internally with success, Sanfilippo decided to open source it, announcing the project on Hacker News. The project began to get traction, particularly among the Ruby community, with GitHub and Instagram being among the first companies adopting it.[26][27]

Sanfilippo was hired by VMware in March, 2010.[28][29][30]

In May, 2013, Redis was sponsored by Pivotal Software (a VMware spin-off).[31]

In June 2015, development became sponsored by Redis Labs.[32]

In October 2018, Redis 5.0 was released, introducing Redis Stream – a new data structure that allows storage of multiple fields and string values with an automatic, time-based sequence at a single key.[33]

In June 2020, Salvatore Sanfilippo stepped down as Redis' sole maintainer. Sanfilippo was succeeded by Yossi Gottlieb and Oran Agra.[34][35]

Differences from other database systems

Redis popularized the idea of a system that can be considered a store and a cache at the same time. It was designed so that data is always modified and read from the main computer memory, but also stored on disk in a format that is unsuitable for random data access. The formatted data is only reconstructed into memory once the system restarts.

Redis also provides a data model that is very unusual compared to a relational database management system (RDBMS). User commands do not describe a query to be executed by the database engine but rather specific operations that are performed on given abstract data types. Therefore data must be stored in a way which is suitable later for fast retrieval. The retrieval is done without help from the database system in form of secondary indexes, aggregations or other common features of traditional RDBMS. The Redis implementation makes heavy use of the fork system call, to duplicate the process holding the data, so that the parent process continues to serve clients while the child process creates an in-memory copy of the data on disk.

Popularity

According to monthly DB-Engines rankings, Redis is often the most popular key–value database.[8] Redis has also been ranked the #4 NoSQL database in user satisfaction and market presence based on user reviews,[36] the most popular NoSQL database in containers,[37] and the #4 Data store of 2019 by ranking website stackshare.io.[38] It was voted most loved database in the Stack Overflow Developer Survey in 2017, 2018, 2019, 2020 and 2021.[39]

Supported languages

Since version 2.6, Redis features server-side scripting in the language Lua.[40]

Many programming languages have Redis language bindings on the client side, including:[41] ActionScript, C, C++, C#, Chicken, Clojure, Common Lisp, Crystal, D, Dart, Delphi,[42] Elixir, Erlang, Go, Haskell, Haxe, Io, Java, Nim, JavaScript (Node.js), Julia, Lua, Objective-C, OCaml, Perl, PHP, Pure Data, Python, R,[43] Racket, Ruby, Rust, Scala, Smalltalk, Swift, and Tcl. Several client software programs exist in these languages.[41]

Data types

Redis maps keys to types of values. An important difference between Redis and other structured storage systems is that Redis supports not only strings, but also abstract data types:

  • Lists of strings
  • Sets of strings (collections of non-repeating unsorted elements)
  • Sorted sets of strings (collections of non-repeating elements ordered by a floating-point number called score)
  • Hash tables where keys and values are strings
  • HyperLogLogs used for approximated set cardinality size estimation, available since Redis 2.8.9 in April 2014.[33]
  • Stream of entries with consumer groups, allows you to store multiple fields and string values with an automatic, time-based sequence at a single key, available since Redis 5.0 in October 2018[33]
  • Geospatial data through the implementation of the geohash technique, available since Redis 3.2.[44]

The type of a value determines what operations (called commands) are available for the value. Redis supports high-level, atomic, server-side operations like intersection, union, and difference between sets and sorting of lists, sets and sorted sets.

More data types are supported based on Redis Modules API. Note, that some of them are dual licensed, and not under the BSD 3 clause:[45]

  • JSON – RedisJSON[46] implements ECMA-404 (the JavaScript Object Notation Data Interchange Standard) as a native data type.[47]
  • Search - A query engine for Redis, providing secondary indexing, full-text search, vector similarity search and aggregations.[48]
  • Time series – RedisTimeSeries[49] implements a time series data structure
  • Bloom filter, Cuckoo filter, Count–min sketch, and Top-K – RedisBloom[50] implements a set of probabilistic data structures for Redis
  • Others [51]

Former implementations include:

  • Graph – RedisGraph[52] implements a queryable property graph

Persistence

Redis typically holds the whole dataset in memory. Versions up to 2.4 could be configured to use what they refer to as virtual memory[55] in which some of the dataset is stored on disk, but this feature is deprecated. Persistence in Redis can be achieved through two different methods. First by snapshotting, where the dataset is asynchronously transferred from memory to disk at regular intervals as a binary dump, using the Redis RDB Dump File Format. Alternatively by journaling, where a record of each operation that modifies the dataset is added to an append-only file (AOF) in a background process. Redis can rewrite the append-only file in the background to avoid an indefinite growth of the journal. Journaling was introduced in version 1.1 and is generally considered the safer approach.

By default, Redis writes data to a file system at least every 2 seconds, with more or less robust options available if needed. In the case of a complete system failure on default settings, only a few seconds of data would be lost.

Replication

Redis supports master–replica replication. Data from any Redis server can replicate to any number of replicas. A replica may be a master to another replica. This allows Redis to implement a single-rooted replication tree. Redis replicas can be configured to accept writes, permitting intentional and unintentional inconsistency between instances. The publish–subscribe feature is fully implemented, so a client of a replica may subscribe to a channel and receive a full feed of messages published to the master, anywhere up the replication tree. Replication is useful for read (but not write) scalability or data redundancy.[56]

Performance

When the durability of data is not needed, the in-memory nature of Redis allows it to perform well compared to database systems that write every change to disk before considering a transaction committed.[5] Redis operates as a single process and is single-threaded or double-threaded when it rewrites the AOF (append-only file).[57] Thus, a single Redis instance cannot use parallel execution of tasks such as stored procedures.

Clustering

Redis introduced clustering in April 2015 with the release of version 3.0.[58] The cluster specification implements a subset of Redis commands: all single-key commands are available, multi-key operations (commands related to unions and intersections) are restricted to keys belonging to the same node, and commands related to database selection operations are unavailable.[59] A Redis cluster can scale up to 1,000 nodes, achieve "acceptable" write safety and to continue operations when some nodes fail.[60][61]

Use cases

Due to the nature of the database design, typical use cases are session caching, full page cache, message queue applications, leaderboards and counting among others.[62] The publish–subscribe messaging paradigm allows real-time communication between servers.

Amazon Web Services offers a managed Redis service called ElastiCache for Redis, Google offers a managed Redis service called Cloud Memorystore,[63] Microsoft offers Azure Cache for Redis in Azure,[64] and Alibaba offers ApsaraDB for Redis in Alibaba Cloud.[65]

Users

Redis is being used in companies like Twitter,[12][13][66] AirBnB,[14] Tinder,[15] Yahoo,[16] Adobe,[17] Hulu,[18] and Amazon.[19]

See also

References

  1. 1.0 1.1 Bernardi, Stefano (January 4, 2011). "An interview with Salvatore Sanfilippo, creator of Redis, working out of Sicily". Menlo Media. http://www.eu-startups.com/2011/01/an-interview-with-salvatore-sanfilippo-creator-of-redis-working-out-of-sicily/. 
  2. 2.0 2.1 Haber, Itamar (July 15, 2015). "Salvatore Sanfilippo: Welcome to Redis Labs". https://redis.com/blog/salvatore-sanfilippo-welcome-to-redis-labs. 
  3. "Introduction to Redis". https://redis.io/topics/introduction. "Redis is written in ANSI C and works in most POSIX systems like Linux, *BSD, OS X without external dependencies." 
  4. 4.0 4.1 "Copying". 4 March 2022. https://github.com/antirez/redis/blob/unstable/COPYING. 
  5. 5.0 5.1 5.2 5.3 "FAQ: Redis" (in en-US). https://redis.io/topics/faq. 
  6. "Google Groups". https://groups.google.com/d/msg/redis-db/MtwjZC5gCeE/f-5T-OIcCW8J. 
  7. "Redis" (in en). https://redis.io/. 
  8. 8.0 8.1 "DB-Engines Ranking - popularity ranking of key-value stores". http://db-engines.com/en/ranking/key-value+store. 
  9. Clark, Lindsay. "Redis becomes the most popular database on AWS as complex cloud application deployments surge" (in en). https://www.theregister.com/2020/11/23/redis_the_most_popular_db_on_aws/. 
  10. "Instablinks EP 07: Redis™—The Most Popular In-Memory Database Technology" (in en). https://www.instaclustr.com/resources/instablinks-ep-07-redis-the-most-popular-in-memory-database-technology/. 
  11. "DB-Engines Ranking" (in en). https://db-engines.com/en/ranking. 
  12. 12.0 12.1 (in en) Scaling Redis at Twitter, https://www.youtube.com/watch?v=rP9EKvWt0zo, retrieved 2023-07-22 
  13. 13.0 13.1 (in en) Using Redis at Scale at Twitter - by Rashmi Ramesh of Twitter - RedisConf17 -, https://www.youtube.com/watch?v=QznaOSk20nU, retrieved 2023-07-22 
  14. 14.0 14.1 (in en) AWS re:Invent 2018: Airbnb's Journey from Self-Managed Redis to ElastiCache for Redis (DAT319), https://www.youtube.com/watch?v=eyd_8efUCwM, retrieved 2023-07-22 
  15. 15.0 15.1 "Building resiliency at scale at Tinder with Amazon ElastiCache | AWS Database Blog" (in en-US). 2020-01-30. https://aws.amazon.com/blogs/database/building-resiliency-at-scale-at-tinder-with-amazon-elasticache/. 
  16. 16.0 16.1 (in en) AWS re:Invent 2022 - How Yahoo cost optimizes their in-memory workloads with AWS (DAT321), https://www.youtube.com/watch?v=jEwrcpq2mLM, retrieved 2023-07-22 
  17. 17.0 17.1 (in en) AWS re:Invent 2014 | (SDD402) Amazon ElastiCache Deep Dive, https://www.youtube.com/watch?v=cEkHBqhQnog, retrieved 2023-07-22 
  18. 18.0 18.1 "Hulu Case Study" (in en-US). https://aws.amazon.com/solutions/case-studies/hulu/. 
  19. 19.0 19.1 "Amazon GameOn Database Migration Case Study – Amazon Web Services (AWS)" (in en-US). https://aws.amazon.com/solutions/case-studies/amazon-gameon/. 
  20. "Elevated API Errors" (in en). https://status.openai.com/incidents/fk0tcbydtybr. 
  21. "A conversation with Salvatore Sanfilippo, creator of the open-source database Redis" (in en-US). 2016-06-20. https://venturebeat.com/2016/06/19/redis-creator/. 
  22. Kepes, Ben (July 15, 2015). "Redis Labs hires the creator of Redis, Salvatore Sanfilippo". http://www.networkworld.com/article/2947895/opensource-subnet/redis-labs-hires-the-creator-of-redis-salvatore-sanfilippo.html. 
  23. Francisco, Thomas Claburn in San. "Database maestro Antirez says arrivederci to Redis: Seems he wants an unstructured life writing code, not a structured one managing software" (in en). https://www.theregister.com/2020/06/30/redis_creator_antirez_quits/. 
  24. "Database startup Redis Labs rebrands as ... just Redis" (in en-US). 2021-08-11. https://siliconangle.com/2021/08/11/redis-labs-rebrands-redis/. 
  25. Sanfilippo, Salvatore (April 28, 2017). "Tcl prototype of Redis". https://gist.github.com/antirez/6ca04dd191bdb82aad9fb241013e88a8. 
  26. Wanstrath, Chris (November 3, 2009). "Introducing Resque". https://blog.github.com/2009-11-03-introducing-resque/. 
  27. Krieger, Mike (October 31, 2011). "Storing hundreds of millions of simple key-value pairs in Redis". https://instagram-engineering.com/storing-hundreds-of-millions-of-simple-key-value-pairs-in-redis-1091ae80f74c. 
  28. Shapira, Gwen (March 17, 2010). "VMware Hires Redis Key Developer – But Why?". https://prodlife.wordpress.com/2010/03/17/vmware-hires-redis-key-developer-but-why/. 
  29. Sanfilippo, Salvatore (March 15, 2010). "VMware: the new Redis home". http://antirez.com/post/vmware-the-new-redis-home.html. 
  30. Collison, Derek (March 15, 2010). "VMware: The Console: VMware hires key developer for Redis". http://blogs.vmware.com/console/2010/03/vmware-hires-key-developer-for-redis.html. 
  31. Sanfilippo, Salvatore. "Redis Sponsors". Redis Labs. https://redis.io/topics/sponsors. 
  32. Sanfilippo, Salvatore (July 15, 2015). "Thanks Pivotal, Hello Redis Labs". http://antirez.com/news/91. 
  33. 33.0 33.1 33.2 "Redis 5.0 is here!". 22 October 2018. https://redis.com/blog/redis-5-0-is-here/. 
  34. "Database maestro Antirez says arrivederci to Redis: Seems he wants an unstructured life writing code, not a structured one managing software". https://www.theregister.com/2020/06/30/redis_creator_antirez_quits/. 
  35. "The end of the Redis adventure -". http://antirez.com/news/133. 
  36. "Best NoSQL Databases: Fall 2015 Report from G2 Crowd". G2 Crowd. http://about.g2crowd.com/press-release/best-nosql-databases-fall-2015/. 
  37. "8 Surprising Facts about Real Docker Adoption". 13 June 2018. https://www.datadoghq.com/docker-adoption/. 
  38. "🏆 The Top 50 Developer Tools of 2019" (in en). https://stackshare.io/posts/top-developer-tools-2019. 
  39. "Developer Survey Results 2021: Most Loved, Dreaded, and Wanted Databases". Stack Exchange. https://insights.stackoverflow.com/survey/2021#section-most-loved-dreaded-and-wanted-databases. 
  40. "EVAL – Redis". https://redis.io/commands/eval. 
  41. 41.0 41.1 "Redis". https://redis.io/clients. 
  42. "Danieleteti/Delphiredisclient". 17 September 2022. https://github.com/danieleteti/delphiredisclient. 
  43. Lewis, B. W. (5 July 2015). "rredis: "Redis" Key/Value Database Client". https://cran.r-project.org/web/packages/rredis/. 
  44. "Redis 3.2 Release Notes". https://github.com/antirez/redis/blob/3.2/00-RELEASENOTES. 
  45. "Redis Licensing Overview" (in en). https://redis.com/legal/licenses/. 
  46. "RedisJSON - a JSON data type for Redis". https://oss.redis.com/redisjson/. 
  47. "RedisJSON - a JSON data type for Redis". http://redisjson.io. 
  48. RediSearch, RediSearch, 2023-09-30, https://github.com/RediSearch/RediSearch, retrieved 2023-09-30 
  49. "RedisTimeSeries - Time-Series data structure for Redis". https://oss.redis.com/redistimeseries. 
  50. "RedisBloom - Probabilistic Datatypes Module for Redis". https://oss.redis.com/redisbloom/. 
  51. "Modules" (in en). https://redis.io/resources/modules/. 
  52. "RedisGraph - a graph database module for Redis". https://oss.redis.com/redisgraph/. 
  53. Kogan, Lior (2023-07-05). "RedisGraph End-of-Life Announcement" (in en). https://redis.com/blog/redisgraph-eol/. 
  54. FalkorDB, FalkorDB, 2023-09-29, https://github.com/FalkorDB/FalkorDB, retrieved 2023-09-30 
  55. "Virtual Memory". https://redis.io/topics/virtual-memory. 
  56. "Google Code Archive - Long-term storage for Google Code Project Hosting.". https://code.google.com/p/redis/wiki/ReplicationHowto. 
  57. "Redis on the Raspberry Pi: adventures in unaligned lands - <antirez>". http://antirez.com/news/111. 
  58. "Redis 3.0 Release Notes". https://github.com/antirez/redis/blob/3.0/00-RELEASENOTES. 
  59. "Cluster Spec". https://redis.io/topics/cluster-spec#implemented-subset. 
  60. "Cluster Spec". https://redis.io/topics/cluster-spec. 
  61. "Cluster Tutorial". https://redis.io/topics/cluster-tutorial. 
  62. "Top 5 Redis use cases - ObjectRocket". Rackspace. 7 November 2017. http://objectrocket.com/blog/how-to/top-5-redis-use-cases. 
  63. "Memorystore: in-memory data store" (in en). https://cloud.google.com/memorystore. 
  64. "Azure Redis Cache - Redis cache cloud service - Microsoft Azure". https://azure.microsoft.com/en-us/services/cache/. 
  65. "ApsaraDB for Redis: A Key Value Database Service - Alibaba Cloud". https://www.alibabacloud.com/product/apsaradb-for-redis. 
  66. "How Twitter Uses Redis to Scale - 105TB RAM, 39MM QPS, 10,000+ Instances - High Scalability". http://highscalability.com/blog/2014/9/8/how-twitter-uses-redis-to-scale-105tb-ram-39mm-qps-10000-ins.html. 

Further reading

External links