20 Matching Annotations
  1. May 2023
    1. A perhaps surprising result from the Gilbert paper is that no implementation of an atomic register in an asynchronous network can be available at all times, and consistent only when no messages are lost. This result depends upon the asynchronous network property, the idea being that it is impossible to tell if a message has been dropped and therefore a node cannot wait indefinitely for a response while still maintaining availability, however if it responds too early it might be inconsistent.

      ?

    1. Why is this? I think it might be because software engineering is a really permeable field. You can start out learning Rails, and in two years wind up running four distributed databases by accident. Not everyone chose or could afford formal education, or was lucky enough to have a curmudgeonly mentor, or happened to read the right academic papers or find the right blogs. Now they might be using Redis as a lock server, or storing financial information in MongoDB. Is this dangerous? I honestly don’t know. Depends on how they’re using the system.

      程序员门槛低

    2. You could do this as an application developer by setting every Redis node to be a primary, and writing a proxy layer which uses, say, consistent hashing and active anti-entropy to replicate writes between nodes. Take a look at Antirez’s own experiments in this direction. If you want a CP system, you could follow Datomic’s model and use immutable shared-structure values in Redis, combined with, say, Zookeeper for mutable state.

      How to implement CP or AP on Redis

    1. In general Redis + Sentinel as a whole are an eventually consistent system where the merge function is last failover wins, and the data from old masters are discarded to replicate the data of the current master, so there is always a window for losing acknowledged writes. This is due to Redis asynchronous replication and the discarding nature of the "virtual" merge function of the system. Note that this is not a limitation of Sentinel itself, and if you orchestrate the failover with a strongly consistent replicated state machine, the same properties will still apply. There are only two ways to avoid losing acknowledged writes: Use synchronous replication (and a proper consensus algorithm to run a replicated state machine). Use an eventually consistent system where different versions of the same object can be merged.

      summary

    2. This means that the quorum can be used to tune Sentinel in two ways:

      有两个quorum(odown, failover)的原因

    3. However the quorum is only used to detect the failure. In order to actually perform a failover, one of the Sentinels need to be elected leader for the failover and be authorized to proceed. This only happens with the vote of the majority of the Sentinel processes.

      why?

  2. Apr 2023
    1. So you can say, ok, Sentinel has a limited scope, but could you add a feature so that when the master feels in the minority it no longer accept writes? I don't think it's a good idea. What it means to be in the minority for a Redis master monitored by Sentinels (especially given that Redis and Sentinel are completely separated systems)?

      不适合quorum

    1. Safe Publication and Safe Initialization idioms are great abstractions over Java Memory Model rules. Used carefully, these idioms can be used as building blocks for constructing larger concurrent programs without breaking correctness.

      Conclusion

    2. The caveat is apparent here: we can not easily drop the Singleton instance from memory. Even if we lose all the references to the factory, the VM still needs to retain the class and its static fields.

      caveat

    3. Holder is lying to us: even though we instantiate a HolderFactory, the singleton is already initialized, and just sits there in a static field. The performance data for this idiom is unreliable.

      为什么不准确?

    1. For example, this is how the method Thread.sleep() is designed (taking a very primitive approach):

      check the implementation

  3. Nov 2022
    1. 摩根

      专有名词不应该翻译

    2. 快递

      typo

      The express json-parser we took into use earlier is a so-called middleware.

    3. 空闲

      typo: 幂等

      idempotence

    4. 同位素

      typo

      Methods can also have the property of "idempotence" in that (aside from error or expiration issues) the side-effects of N > 0 identical requests is the same as for a single request. The methods GET, HEAD, PUT and DELETE share this property

    5. 空闲

      typo: 幂等

      idempotence

    6. < i>npm test

      typo

    7. 运行时间

      typo: 运行时

      JavaScript runtime

    8. 堆栈

      typo: 栈

      In this part our focus shifts towards the backend: that is, towards implementing functionality on the server side of the stack.

    1. It tries to acquire the lock in all the N instances sequentially

      能并发请求吗?