Jump to content

Redis: Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
Ease of reference. Wikilinked Salvatore Sanfilippo on 1st use in 1st paragraph. Saves reader from having to jump back to Infobox to find wikilink.
Tags: Mobile edit Mobile web edit
Deleted left parenthesis added by accident
Tags: Mobile edit Mobile web edit
Line 11: Line 11:
| screenshot alt =
| screenshot alt =
| caption =
| caption =
| author = [[Salvatore Sanfilippo]](<ref name="creator1">{{cite web |url=http://www.eu-startups.com/2011/01/an-interview-with-salvatore-sanfilippo-creator-of-redis-working-out-of-sicily/ |title=An interview with Salvatore Sanfilippo, creator of Redis, working out of Sicily |date=January 4, 2011 |last=Bernardi |first=Stefano |website=EU-Startups |publisher=Menlo Media}}</ref><ref name="creator2">{{cite web |url=https://redislabs.com/blog/salvatore-sanfilippo-welcome-to-redis-labs |title=Salvatore Sanfilippo: Welcome to Redis Labs |date=July 15, 2015 |last=Haber |first=Itamar |website=Redis Labs}}</ref>
| author = [[Salvatore Sanfilippo]]<ref name="creator1">{{cite web |url=http://www.eu-startups.com/2011/01/an-interview-with-salvatore-sanfilippo-creator-of-redis-working-out-of-sicily/ |title=An interview with Salvatore Sanfilippo, creator of Redis, working out of Sicily |date=January 4, 2011 |last=Bernardi |first=Stefano |website=EU-Startups |publisher=Menlo Media}}</ref><ref name="creator2">{{cite web |url=https://redislabs.com/blog/salvatore-sanfilippo-welcome-to-redis-labs |title=Salvatore Sanfilippo: Welcome to Redis Labs |date=July 15, 2015 |last=Haber |first=Itamar |website=Redis Labs}}</ref>
| developer = Redis Labs<ref name="creator1" /><ref name="creator2" />
| developer = Redis Labs<ref name="creator1" /><ref name="creator2" />
| released = {{Start date and age|2009|05|10}}
| released = {{Start date and age|2009|05|10}}

Revision as of 08:22, 7 July 2021

Redis
Original author(s)Salvatore Sanfilippo[1][2]
Developer(s)Redis Labs[1][2]
Initial releaseMay 10, 2009; 15 years ago (2009-05-10)
Stable release
7.4.1[3] Edit this on Wikidata / October 2, 2024; 2 months ago (October 2, 2024)
Repository
Written inC
Operating systemUnix-like[4]
Available inEnglish
TypeData structure store, key-value database
LicenseBSD 3-clause[5]
Websiteredis.io Edit this on Wikidata

Redis (/ˈrɛdɪs/;[6][7] Remote Dictionary Server)[6] is an in-memory data structure store, used as a distributed, in-memory key–value database, cache and message broker, with optional durability. 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.[8] Since 2015, he led a project core team sponsored by Redis Labs.[9] Salvatore Sanfilllippo left Redis as the maintainer in 2020.[10] It is open-source software released under a BSD 3-clause license.[5]

History

The name Redis means REmote DIctionary Server.[6] 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 to prototype a first proof of concept version of Redis in Tcl.[11] 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, more so among the Ruby community, with GitHub and Instagram being among the first companies adopting it.[12][13]

Sanfilippo was hired by VMware in March, 2010.[14][15][16]

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

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

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.[19]

In June 2020 Salvatore Sanfilippo stepped down as Redis maintainer.[20][21]

Differences from other database systems

Redis popularized the idea of a system that can be considered at the same time a store and a cache, using a design where data is always modified and read from the main computer memory, but also stored on disk in a format that is unsuitable for random access of data, but only to reconstruct the data back in memory once the system restarts. At the same time, Redis 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. Hence, data must be stored in a way which is suitable later for fast retrieval, 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 a copy of the data on disk.

Popularity

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

Supported languages

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

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

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.[19]
  • 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[19]
  • Geospatial data through the implementation of the geohash technique, available since Redis 3.2.[30]

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.[31] The Redis module RedisJSON implements ECMA-404 (the JavaScript Object Notation (JSON) Data Interchange Standard) as a native data type.[32]

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[33] 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.[34]

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.[6] Redis operates as a single process and is single-threaded or double-threaded when it rewrites the AOF (append-only file).[35] 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.[36] 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.[37] A Redis cluster can scale up to 1,000 nodes, achieve "acceptable" write safety and to continue operations when some nodes fail.[38][39]

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.[40] Large companies such as Twitter are using Redis,[41] Amazon Web Services offers a managed Redis service called Elasticache for Redis, Microsoft offers Azure Cache for Redis in Azure,[42] and Alibaba is offering ApsaraDB for Redis in Alibaba Cloud.[43]

See also

References

  1. ^ a b Bernardi, Stefano (January 4, 2011). "An interview with Salvatore Sanfilippo, creator of Redis, working out of Sicily". EU-Startups. Menlo Media.
  2. ^ a b Haber, Itamar (July 15, 2015). "Salvatore Sanfilippo: Welcome to Redis Labs". Redis Labs.
  3. ^ "Release 7.4.1". 2 October 2024. Retrieved 27 October 2024.
  4. ^ "Introduction to Redis". Redis is written in ANSI C and works in most POSIX systems like Linux, *BSD, OS X without external dependencies.
  5. ^ a b "Copying". GitHub.
  6. ^ a b c d "FAQ: Redis". Redis.io.
  7. ^ "Google Groups". groups.google.com.
  8. ^ "A conversation with Salvatore Sanfilippo, creator of the open-source database Redis". VentureBeat. 2016-06-20. Retrieved 2021-06-29.
  9. ^ Kepes, Ben (July 15, 2015). "Redis Labs hires the creator of Redis, Salvatore Sanfilippo". Network World. Retrieved August 30, 2015.
  10. ^ 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". www.theregister.com. Retrieved 2021-06-29.
  11. ^ Sanfilippo, Salvatore (April 28, 2017). "Tcl prototype of Redis". GitHub Gist. Retrieved October 8, 2018.
  12. ^ Wanstrath, Chris (November 3, 2009). "Introducing Resque". Blog. Retrieved October 8, 2018.
  13. ^ Krieger, Mike (October 31, 2011). "Storing hundreds of millions of simple key-value pairs in Redis". Instagram Engineering Blog. Retrieved October 8, 2018.
  14. ^ Shapira, Gwen (March 17, 2010). "VMware Hires Redis Key Developer – But Why?". Blog. Retrieved September 25, 2016.
  15. ^ Sanfilippo, Salvatore (March 15, 2010). "VMware: the new Redis home". Blog. Retrieved September 25, 2016.
  16. ^ Collison, Derek (March 15, 2010). "VMware: The Console: VMware hires key developer for Redis". VMware Blog. Archived from the original on March 22, 2010. Retrieved September 25, 2016.
  17. ^ Sanfilippo, Salvatore. "Redis Sponsors". Redis.io. Redis Labs. Retrieved April 11, 2019.
  18. ^ Sanfilippo, Salvatore (July 15, 2015). "Thanks Pivotal, Hello Redis Labs". <antirez>. Retrieved 2019-04-03.
  19. ^ a b c https://redislabs.com/blog/redis-5-0-is-here/
  20. ^ https://www.theregister.com/2020/06/30/redis_creator_antirez_quits/ source
  21. ^ "The end of the Redis adventure -". antirez.com. Retrieved 2020-11-10.
  22. ^ "DB-Engines Ranking - popularity ranking of key-value stores". DB-Engines.
  23. ^ "Best NoSQL Databases: Fall 2015 Report from G2 Crowd". G2 Crowd.
  24. ^ "8 Surprising Facts about Real Docker Adoption". Datadog.
  25. ^ "🏆 The Top 50 Developer Tools of 2019". StackShare. Retrieved 2020-07-28.
  26. ^ "Developer Survey Results 2019: Most Loved, Dreaded, and Wanted Databases". Stack Overflow. Stack Exchange. Retrieved 2018-11-10.
  27. ^ "EVAL – Redis". redis.io.
  28. ^ a b "Redis". redis.io.
  29. ^ Lewis, B. W. (5 July 2015). "rredis: "Redis" Key/Value Database Client". The Comprehensive R Archive Network. Retrieved 2019-04-03.
  30. ^ "Redis 3.2 Release Notes". GitHub. Retrieved 2017-03-10.
  31. ^ "Redis Modules: an introduction to the API". redis.io. Retrieved 2019-07-10.
  32. ^ "RedisJSON - a JSON data type for Redis". redisjson.io.
  33. ^ "Virtual Memory". Redis.io. Retrieved April 11, 2019.
  34. ^ "Google Code Archive - Long-term storage for Google Code Project Hosting". code.google.com.
  35. ^ "Redis on the Raspberry Pi: adventures in unaligned lands - <antirez>". antirez.com.
  36. ^ "Redis 3.0 Release Notes". Retrieved 2017-03-10.
  37. ^ "Cluster Spec". Retrieved 2017-03-10.
  38. ^ "Cluster Spec". Retrieved 2017-03-10.
  39. ^ "Cluster Tutorial". Retrieved 2017-03-10.
  40. ^ "Top 5 Redis use cases - ObjectRocket". ObjectRocket. Rackspace. 7 November 2017.
  41. ^ "How Twitter Uses Redis to Scale - 105TB RAM, 39MM QPS, 10,000+ Instances - High Scalability". Highscalability.com.
  42. ^ "Azure Redis Cache - Redis cache cloud service - Microsoft Azure". azure.microsoft.com.
  43. ^ "ApsaraDB for Redis: A Key Value Database Service - Alibaba Cloud". www.alibabacloud.com.

Further reading