zoukankan      html  css  js  c++  java
  • Redis宣言

    http://oldblog.antirez.com/post/redis-manifesto.html

    Redis Manifesto Redis宣言

    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 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的开发进入一个缺乏快感的歧路中。
  • 相关阅读:
    linux系统缓存机制
    信号“未决”与“阻塞”
    异步I/O
    Unix下五种IO模型
    【设计模式
    【设计模式
    【设计模式
    【设计模式
    【设计模式
    【设计模式
  • 原文地址:https://www.cnblogs.com/blockcipher/p/3507023.html
Copyright © 2011-2022 走看看