zoukankan      html  css  js  c++  java
  • 分布式数据库

    1. 分布式数据库领域CAP理论

    Consistency(一致性), 数据一致更新,所有数据变动都是同步的
    Availability(可用性), 好的响应性能
    Partition tolerance(分区容错性) 可靠性,A single piece of data is stored in 3 nodes, 1 node failed, the other 2 nodes can still work. This is implemented via Replication or Duplication. 也就是没有单点失败

    定理:任何分布式系统只可同时满足二点,没法三者兼顾。
    忠告:架构师不要将精力浪费在如何设计能满足三者的完美分布式系统,而是应该进行取舍。

    2. 为什么Partition Tolerance is mandatory?
    串行系统 VS 并行系统(Partition Tolerance)的可用性对比。
    • 对于应用服务器,并行意味着多台相同的应用服务器cluster,通常在cluster前端配置有load balance,这个cluster在eBay中叫pool
    • 对于数据库服务器,并行意味着热备份的多台数据库服务器(Replication),一般至少有两台(master,failover server)
    一个大系统一般都有超过 30 个环节(串行):如果每个环节都做到 99% 的准确率,最终系统的准确率是 74%; 如果每个环节都做到98%的准确率,最终系统的准确率 54%。

    如果是并行系统,准确率如下面formula:
    P(any failure) = 1 – P(individual node not failing)number of nodes
    如系统中每个模块的准确率是70%,那么3个模块并行,整体准确率=1-0.3^3=97.3%,如果是4个并行,准确率=1-0.3^4=99.19%,我在想这就是负载均衡靠谱的数学原理
    5个9或6个9的QoS一定是指数思维的结果,线性思维等于送死
    Reference: http://blog.sina.com.cn/s/blog_5459f60d01016ntb.html

    3. 为什么在PT是必须的前提下,Consistency and Availability 二者只能选其一?

    You cannot, however, choose both consistency and availability in a distributed system.

    As a thought experiment, imagine a distributed system which keeps track of a single piece of data using three nodes—AB, and C—and which claims to be both consistent and available in the face of network partitions. Misfortune strikes, and that system is partitioned into two components: {A,B} and {C}. In this state, a write request arrives at node C to update the single piece of data.

    That node only has two options:

    1. Accept the write, knowing that neither A nor B will know about this new data until the partition heals.
    2. Refuse the write, knowing that the client might not be able to contact A or B until the partition heals.

    You either choose availability (Door #1) or you choose consistency (Door #2). You cannot choose both.

    Refrence: http://codahale.com/you-cant-sacrifice-partition-tolerance/

    4.分布式数据库的优缺点

    优点:

    • 提高系统的可靠性、可用性当某一场地出现故障时,系统可以对另一场地上的相同副本进行操作,不会因一处故障而造成整个系统的瘫痪。
    • 提高系统性能系统可以根据距离选择离用户最近的数据副本进行操作,减少通信代价,改善整个系统的性能。
    • 易于扩展,如果服务器软件支持透明的水平扩展,那么就可以增加多个服务器来进一步分布数据和分担处理任务。(关于水平扩展可以参考http://xuezhongfeicn.blog.163.com/blog/static/22460141201201153456711/, eBay的数据库存储就是水平扩展的)
    缺点:
    • 事务管理的性能比在集中式数据库花费更高,很难保证高度一致性
    • 系统开销大,主要花在通信部分。
    • 复杂的存取结构,原来在集中式系统中有效存取数据的技术

    版权声明:本文为博主原创文章,未经博主允许不得转载。

  • 相关阅读:
    叶落归根(hometown)
    设置(settings)
    文明距离(civil)
    计算机基础知识
    gojs插件使用教程
    编程语言分类
    dp优化简单总结
    Splay入门题目 [HNOI2002]营业额统计
    hdu3415:最大k子段和,单调队列
    hdu5072(鞍山regional problem C):容斥,同色三角形模型
  • 原文地址:https://www.cnblogs.com/significantfrank/p/4875845.html
Copyright © 2011-2022 走看看