http://oldblog.antirez.com/post/redis-manifesto.htmlhtml
Many times I don't know what to exactly reply to feature requests, or questions about why things in Redis are done in a specific way. Most of the time the questions make a lot of sense, there is not just a way to make things in programming, a lot is about your taste, feeling, and ideas about how software should be written. So I tried to condense my feelings about Redis and software development in general in this short manifest, that I'll include in the Redis distribution. There are an infinite number of ways of doing things, this is just the one I and a good part of the Redis community like.
不少時候,我不知道該如何回答爲何須要某個特性或者在redis中爲何按照這種方式來作。大多數情形下,這些問題沒有什麼意義。編程不僅是作事的一種方式,還包括你對如何寫軟件的品味、感情和想法。我把我對Redis和軟件開發的感情總結在這個短短的宣言中,這個宣言也將放入Redis發佈包中。作事的方法有千萬種,這只是其中一種,是Redis社區喜歡的一種。redis
Redis Manifesto
Redis宣言數據庫
- 1 - A DSL for Abstract Data Types. Redis is a DSL (Domain Specific Language) that manipulates abstract data types and implemented as a TCP daemon. Commands manipulate a key space where keys are binary-safe strings and values are different kinds of abstract data types. Every data type represents an abstract version of a fundamental data structure. For instance Redis Lists are an abstract representation of linked lists. In Redis, the essence of a data type isn't just the kind of operations that the data types support, but also the space and time complexity of the data type and the operations performed upon it.
- 1 - 抽象數據類型的領域特定語言。Redis是一種領域特定語言,用做操做抽象數據類型,採用TCP服務實現。命令用做操做key空間,其中key是二進制串,值是各類各樣的抽象數據類型。每種數據類型是基礎數據結構的一個抽象版本。例如,Redis的Lists是鏈表的抽象表示。在Redis中,數據類型本質上不單單是該數據類型支持的操做,還包括該數據類型和相關操做的時間和空間複雜性。
- 2 - Memory storage is #1. The Redis data set, composed of defined key-value pairs, is primarily stored in the computer's memory. The amount of memory in all kinds of computers, including entry-level servers, is increasing significantly each year. Memory is fast, and allows Redis to have very predictable performance. Datasets composed of 10k or 40 millions keys will perform similarly. Complex data types like Redis Sorted Sets are easy to implement and manipulate in memory with good performance, making Redis very simple. Redis will continue to explore alternative options (where data can be optionally stored on disk, say) but the main goal of the project remains the development of an in-memory database.
- 2 - 內存存儲是線性的。Redis的數據集,由預約義的鍵值對組成,存儲在計算機內存中。各類各樣計算的內存總量,包括入門級服務器,每一年都在迅速增加。內存的速度很是快,使得Redis有很是好的性能。包含10K或4000萬個鍵的數據集在處理上是類似的。像Redis有序集合等複雜數據類型很是容易實現,在內存中處理性能也很是好,Redis自己也很是簡單。Redis將來將探索其餘可替代存儲(例如可選擇將數據存儲在磁盤上)。可是該項目的主要目標是開發基於內存的數據庫。
- 3 - Fundamental data structures for a fundamental API. The Redis API is a direct consequence of fundamental data structures. APIs can often be arbitrary but not an API that resembles the nature of fundamental data structures. If we ever meet intelligent life forms from another part of the universe, they'll likely know, understand and recognize the same basic data structures we have in our computer science books. Redis will avoid intermediate layers in API, so that the complexity is obvious and more complex operations can be performed as the sum of the basic operations.
- 3 - 基礎的數據結構使用基本的API。Redis的API是基本數據結構的基本操做。通常來講API是任意的,但不是任何API都屬於基礎數據結構的基本操做。
- 4 - Code is like a poem; it's not just something we write to reach some practical result. Sometimes people that are far from the Redis philosophy suggest using other code written by other authors (frequently in other languages) in order to implement something Redis currently lacks. But to us this is like if Shakespeare decided to end Enrico IV using the Paradiso from the Divina Commedia. Is using any external code a bad idea? Not at all. Like in "One Thousand and One Nights" smaller self contained stories are embedded in a bigger story, we'll be happy to use beautiful self contained libraries when needed. At the same time, when writing the Redis story we're trying to write smaller stories that will fit in to other code.
- 4 - 代碼如詩,不單單是爲了作些實際事情而寫出來的一些東西。有事,背離Redis哲學的人,建議用其餘做者的哲學(經常是來自其餘語言)來實現Redis缺少的特性。這對咱們來講,就像莎士比亞決定使用但丁的神曲(Divina Commedia)中的Paradiso來結束Enrico IV(<<亨利四世>>)。是否是使用任何外部的代碼都是錯誤的呢?不是的。像<<一千零一晚上>>同樣,小的自足的的故事包含在了更大的故事中,咱們很是樂意在須要時使用自足的小庫。同時,在撰寫Redis的故事時,咱們也試圖撰寫是和其餘項目的更小的故事。
- 5 - We're against complexity. We believe designing systems is a fight against complexity. We'll accept to fight the complexity when it's worthwhile but we'll try hard to recognize when a small feature is not worth 1000s of lines of code. Most of the time the best way to fight complexity is by not creating it at all.
- 5 - 咱們反對複雜性。咱們認爲,設計系統就是和複雜性打仗。在值得的地方咱們願意處理複雜性,可是咱們不會實現一個須要1000多行代碼的小特性。大多數時候,處理複雜性的最好方式就是不處理。
- 6 - Two levels of API. The Redis API has two levels: 1) a subset of the API fits naturally into a distributed version of Redis and 2) a more complex API that supports multi-key operations. Both are useful if used judiciously but there's no way to make the more complex multi-keys API distributed in an opaque way without violating our other principles. We don't want to provide the illusion of something that will work magically when actually it can't in all cases. Instead we'll provide commands to quickly migrate keys from one instance to another to perform multi-key operations and expose the tradeoffs to the user.
- 6 - 兩級API。Redis的API包含兩級:1)API的一個子集,適合包含在Redis發佈版本中,2)比較複雜的API,支持多key操做。
- 7 - We optimize for joy. We believe writing code is a lot of hard work, and the only way it can be worth is by enjoying it. When there is no longer joy in writing code, the best thing to do is stop. To prevent this, we'll avoid taking paths that will make Redis less of a joy to develop.
- 7 - 咱們偏心快感。咱們認爲寫代碼須要大量艱難的工做,值得如此作的惟一理由是從中得到快感。當你從編碼中不能得到快感時,最好的方式就是中止吧。爲了防止如此,咱們避免將Redis的開發進入一個缺少快感的歧路中。