Micro services Shared Database Pattern

Database should almost never be shared among services.

The disadvantages are obvious:

  1. We decline ourselves the opportunity to decide what to share and what not, i.e. no information hiding.
  2. It hard to know which part of the database is safe to change.
  3. It hard to know who controls the data. A micro service is combination of behavior and state, encapsulating one or more state machines. If the behavior that affects the state is spread across the system, making sure that the state machine can be implemented properly is a tricky business.

An exception to this rule no database sharing rule is static reference data, which is usually read-only to the services. Changes to structure is infrequent and usually performed as an administrative task.

要查看或添加评论,请登录

Tony Zhou的更多文章

  • The Yin and Yang of Scala: Any and Nothing

    The Yin and Yang of Scala: Any and Nothing

    There are Yin and Yang in Scala. The Yin: Nothing: The sub type of all types, but have no instance.

  • Distribute your work to improve scalability

    Distribute your work to improve scalability

    Scalability comes from the ability to distribute the work that needs to be done to the proportionally growing software…

  • How to achieve simplicity in software engineering?

    How to achieve simplicity in software engineering?

    Focus only on "not being complex" does not address the issues created in requirements, design and development. To…

  • How to plan scalability

    How to plan scalability

    Use the D-I-D (Design, Implement and Deploy) guide line to plan scalability. That is, in the design phase, you want to…

  • Prefer simplicity to complexity

    Prefer simplicity to complexity

    Complex solutions cost more to build, harm user experience and hinder scalability. 80% of the software engineers and…

    2 条评论
  • Design your program to be monitored

    Design your program to be monitored

    Putting hocks in your program so that it can be easily monitored can greatly increase your confidence of the health of…

  • Removing business logic from transaction processing

    Removing business logic from transaction processing

    If you are a fan of uncle Bob, you will not be strange to his idea of clean architecture, which basically says business…

  • The advantage of "feature flag"

    The advantage of "feature flag"

    Many times we deploy new code to the production environment over the weekend to release a new feature and only find…

  • Storage analysis with marketing rules

    Storage analysis with marketing rules

    Storage may be cheaper and cheaper today. But whenever you are in a business that needs scaling, storage utilisation…

社区洞察

其他会员也浏览了