MANIFESTO 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. [Note: this is the Redis manifesto, for general information about
  2. installing and running Redis read the README file instead.]
  3. Redis Manifesto
  4. ===============
  5. 1 - A DSL for Abstract Data Types. Redis is a DSL (Domain Specific Language)
  6. that manipulates abstract data types and implemented as a TCP daemon.
  7. Commands manipulate a key space where keys are binary-safe strings and
  8. values are different kinds of abstract data types. Every data type
  9. represents an abstract version of a fundamental data structure. For instance
  10. Redis Lists are an abstract representation of linked lists. In Redis, the
  11. essence of a data type isn't just the kind of operations that the data types
  12. support, but also the space and time complexity of the data type and the
  13. operations performed upon it.
  14. 2 - Memory storage is #1. The Redis data set, composed of defined key-value
  15. pairs, is primarily stored in the computer's memory. The amount of memory in
  16. all kinds of computers, including entry-level servers, is increasing
  17. significantly each year. Memory is fast, and allows Redis to have very
  18. predictable performance. Datasets composed of 10k or 40 millions keys will
  19. perform similarly. Complex data types like Redis Sorted Sets are easy to
  20. implement and manipulate in memory with good performance, making Redis very
  21. simple. Redis will continue to explore alternative options (where data can
  22. be optionally stored on disk, say) but the main goal of the project remains
  23. the development of an in-memory database.
  24. 3 - Fundamental data structures for a fundamental API. The Redis API is a direct
  25. consequence of fundamental data structures. APIs can often be arbitrary but
  26. not an API that resembles the nature of fundamental data structures. If we
  27. ever meet intelligent life forms from another part of the universe, they'll
  28. likely know, understand and recognize the same basic data structures we have
  29. in our computer science books. Redis will avoid intermediate layers in API,
  30. so that the complexity is obvious and more complex operations can be
  31. performed as the sum of the basic operations.
  32. 4 - We believe in code efficiency. Computers get faster and faster, yet we
  33. believe that abusing computing capabilities is not wise: the amount of
  34. operations you can do for a given amount of energy remains anyway a
  35. significant parameter: it allows to do more with less computers and, at
  36. the same time, having a smaller environmental impact. Similarly Redis is
  37. able to "scale down" to smaller devices. It is perfectly usable in a
  38. Raspberry Pi and other small ARM based computers. Faster code having
  39. just the layers of abstractions that are really needed will also result,
  40. often, in more predictable performances. We think likewise about memory
  41. usage, one of the fundamental goals of the Redis project is to
  42. incrementally build more and more memory efficient data structures, so that
  43. problems that were not approachable in RAM in the past will be perfectly
  44. fine to handle in the future.
  45. 5 - Code is like a poem; it's not just something we write to reach some
  46. practical result. Sometimes people that are far from the Redis philosophy
  47. suggest using other code written by other authors (frequently in other
  48. languages) in order to implement something Redis currently lacks. But to us
  49. this is like if Shakespeare decided to end Enrico IV using the Paradiso from
  50. the Divina Commedia. Is using any external code a bad idea? Not at all. Like
  51. in "One Thousand and One Nights" smaller self contained stories are embedded
  52. in a bigger story, we'll be happy to use beautiful self contained libraries
  53. when needed. At the same time, when writing the Redis story we're trying to
  54. write smaller stories that will fit in to other code.
  55. 6 - We're against complexity. We believe designing systems is a fight against
  56. complexity. We'll accept to fight the complexity when it's worthwhile but
  57. we'll try hard to recognize when a small feature is not worth 1000s of lines
  58. of code. Most of the time the best way to fight complexity is by not
  59. creating it at all. Complexity is also a form of lock-in: code that is
  60. very hard to understand cannot be modified by users in an independent way
  61. regardless of the license. One of the main Redis goals is to remain
  62. understandable, enough for a single programmer to have a clear idea of how
  63. it works in detail just reading the source code for a couple of weeks.
  64. 7 - Threading is not a silver bullet. Instead of making Redis threaded we
  65. believe on the idea of an efficient (mostly) single threaded Redis core.
  66. Multiple of such cores, that may run in the same computer or may run
  67. in multiple computers, are abstracted away as a single big system by
  68. higher order protocols and features: Redis Cluster and the upcoming
  69. Redis Proxy are our main goals. A shared nothing approach is not just
  70. much simpler (see the previous point in this document), is also optimal
  71. in NUMA systems. In the specific case of Redis it allows for each instance
  72. to have a more limited amount of data, making the Redis persist-by-fork
  73. approach more sounding. In the future we may explore parallelism only for
  74. I/O, which is the low hanging fruit: minimal complexity could provide an
  75. improved single process experience.
  76. 8 - Two levels of API. The Redis API has two levels: 1) a subset of the API fits
  77. naturally into a distributed version of Redis and 2) a more complex API that
  78. supports multi-key operations. Both are useful if used judiciously but
  79. there's no way to make the more complex multi-keys API distributed in an
  80. opaque way without violating our other principles. We don't want to provide
  81. the illusion of something that will work magically when actually it can't in
  82. all cases. Instead we'll provide commands to quickly migrate keys from one
  83. instance to another to perform multi-key operations and expose the
  84. trade-offs to the user.
  85. 9 - We optimize for joy. We believe writing code is a lot of hard work, and the
  86. only way it can be worth is by enjoying it. When there is no longer joy in
  87. writing code, the best thing to do is stop. To prevent this, we'll avoid
  88. taking paths that will make Redis less of a joy to develop.
  89. 10 - All the above points are put together in what we call opportunistic
  90. programming: trying to get the most for the user with minimal increases
  91. in complexity (hanging fruits). Solve 95% of the problem with 5% of the
  92. code when it is acceptable. Avoid a fixed schedule but follow the flow of
  93. user requests, inspiration, Redis internal readiness for certain features
  94. (sometimes many past changes reach a critical point making a previously
  95. complex feature very easy to obtain).