Resiliency:可译为容错性,强调从错误状态恢复的能力。形容词Resilient可译作“可容错的”。

Elasticity:可译为伸缩性,强调根据负载进行水平伸缩的能力。形容词Elastic可译作“可伸缩的”。

Elasticity(可伸缩性):指系统在流量大时能横向扩展,当流量小时又能减少不必要的资源;(https://stackoverflow.com/questions/9587919/what-is-the-difference-between-scalability-and-elasticity)Scalability(可扩放性、可扩展性?、可拓展性?):指系统面对流量压力可以让硬件更强的纵向扩展(scale up)或新增节点的横向扩展(scale out);Resilience(系统回弹性):来源于Resilience Engineering,指系统不仅能够从威胁和压力中恢复过来,而且能够在各种条件下根据需要来运转,并且能适当地应对那些干扰和机遇。(http://erikhollnagel.com/ideas/resilience-engineering.html)

horizon/vertical scale

elastic侧重于易伸缩,所以elastic的东西都是橡皮筋、松紧带、弹性纤维,这类可以“蹦大缩小,拉长缩短”的东西;这个词的关键在于--->>“伸缩”,

flexible侧重于易弯曲,所以flexible的东西都是什么电缆、软管、胶铜线,这类可以“扭来扭去,弯来绕去”的东西;这个词的关键在于--->>“弯曲、扭曲”

resilient侧重于可恢复、可回复,所以resilient的东西都是什么沙发、席梦思、柔嫩的肌肤,这些"坐下去、按下去,会弹起来"的东西;这个词的关键在于--->>“回复、复苏”
Resilient是有韧性,elastic是有弹性。一根弹簧压得很用力很长时间放开之后仍然能够恢复到原有长度叫有韧性,一根弹簧能拉很大也能压到很小叫有弹性。你程序出错了能马上恢复过来叫有韧性,你程序处理能力能大能小叫有弹性。你跌倒了能马上站起来叫有韧性,你能适应不同环境叫有弹性。你在对抗敌人攻击的时候需要有韧性,在和人谈合作的时候需要有弹性。

Sharding and Quorum
Distributed systems often have to store a lot more data, than a single node can do so. So how does one go about storing a bunch of data on a certain number of machines?

Why did idempotency matter when building a large payments system? Most importantly: to avoid double charges or double refunds. Given that our messaging system has at least once, lossless delivery, we need to assume that all messages might be delivered multiple times and systems need to ensure idempotency. We chose to handle this with versioning and optimistic locking, having the sytems that implement idempotent behaviour use a strongly consistent store as their data source.

Let's say we intend to implement idempotency by having optimistic locking in place, to avoid concurrent updates. In order to have optimistic locking, the system needs to be strongly consistent - so that at the time of the operation, we can check if another operation has been initiated, using some sort of versioning.

The idea behind idempotency is merely that the change involved should not be a direct effect of the GET request itself.

Data Durability
Why did data durability matter when building a payments system? For many parts of the system, no data could be lost, given this being something critical, like payments. The distributed data stores we built on needed to support cluster level data durability - so even if instances would crash, completed transactions would persist. These days, most distributed data storage services, like Cassandra, MongoDB, HDFS or Dynamodb all support durability at various levels and can be all configured to provide cluster level durability.

Message Persistence and Durability
However, building a system that delivers each message exactly once or one that delivers at least once is different complexity. We decided to implement a durable messaging system with at least once delivery and chose a messaging bus, on top of which we would build this (we ended up going with Kafka, setting up a lossless cluster for this case).

Consistency is a concept that I spent the most time understanding and appreciating. There are several consistency models, the most common one used in distributed systems being strong consistency, weak consistency and eventual consistency. The Hackernoon article on eventual vs strong consistency gives a nice and practical overview of what the tradeoffs between these models are. Typically, the weaker the consistency required, the faster the system can be, but the more likely it will return not the latest set of data.

关系型数据库的操作通常采用 ORM 库,将表格转换成对象。ORM 主要分成两种类型:Active Record 与 Data Mapper。本文讨论这两种模型的差异和适用场景。

要解决冲突,一种办法是是锁,即基于锁的并发控制,比如2PL,这种方式开销比较高,而且无法避免死锁。多版本并发控制(MVCC)是一种用来解决读-写冲突的无锁并发控制,也就是为事务分配单向增长的时间戳,为每个修改保存一个版本,版本与事务时间戳关联,读操作只读该事务开始前的数据库的快照。 这样在读操作不用阻塞写操作,写操作不用阻塞读操作的同时,避免了脏读和不可重复读乐观并发控制(OCC)是一种用来解决写-写冲突的无锁并发控制,认为事务间争用没有那么多,所以先进行修改,在提交事务前,检查一下事务开始后,有没有新提交改变,如果没有就提交,如果有就放弃并重试。乐观并发控制类似自选锁。乐观并发控制适用于低数据争用,写冲突比较少的环境。多版本并发控制可以结合基于锁的并发控制来解决写-写冲突,即MVCC+2PL,也可以结合乐观并发控制来解决写-写冲突。

MVCC解决的问题是读写互相不阻塞的问题,每次更新都产生一个新的版本,读的话可以读历史版本。试想,如果一个数据只有一个版本,那么多个事务对这个数据进行读写是不是需要读写锁来保护? 一个读写事务在运行的过程中在访问数据之前先加读/写锁这种实现叫做悲观锁,悲观体现在,先加锁,独占数据,防止别人加锁。乐观锁呢,读写事务,在真正的提交之前,不加读/写锁,而是先看一下数据的版本/时间戳,等到真正提交的时候再看一下版本/时间戳,如果两次相同,说明别人期间没有对数据进行过修改,那么就可以放心提交。乐观体现在,访问数据时不提前加锁。在资源冲突不激烈的场合,用乐观锁性能较好。如果资源冲突严重,乐观锁的实现会导致事务提交的时候经常看到别人在他之前已经修改了数据,然后要进行回滚或者重试,还不如一上来就加锁。

distribution system index的更多相关文章

  1. 有个奇怪的问题,配置成/system/index,jsp页面时没有经过过滤器进行拦截,而配置成redirectAction时是可以直接跳转刀片loginJsp.action

    有个奇怪的问题,配置成/system/index,jsp页面时没有经过过滤器进行拦截,而配置成redirectAction时是可以直接跳转刀片loginJsp.action 但是我直接访问/syste ...

  2. C# 中 System.Index 结构体和 Hat 运算符(^)的全新用法

    翻译自 John Demetriou 2019年2月17日 的文章 <C# 8 – Introducing Index Struct And A Brand New Usage For The ...

  3. File System Design Case Studies

    SRC=http://www.cs.rutgers.edu/~pxk/416/notes/13-fs-studies.html Paul Krzyzanowski April 24, 2014 Int ...

  4. magento cache,magento index

    "Magento后台作修改,Magento前台没变化""Magento属性更新了,Magento前台没反应"如果你碰到了以上两种情况,或者看到截图中的提示: 您 ...

  5. C# 中 System.Range 结构体

    翻译自 John Demetriou 2020年4月6日 的文章 <C# 8 Is Introducing Ranges> 我们之前讨论过的 C# 中的一个特性 System.Index ...

  6. 说说C# 8.0 新增功能Index和Range的^0是什么?

    前言 在<C# 8.0 中使用 Index 和 Range>这篇中有人提出^0是什么意思?处于好奇就去试了,结果抛出异常.查看官方文档说^0索引与 sequence[sequence.Le ...

  7. C# 使用 Index 和 Range 简化集合操作

    C# 使用 Index 和 Range 简化集合操作 Intro 有的语言数组的索引值是支持负数的,表示从后向前索引,比如:arr[-1] 从 C# 8 开始,C# 支持了数组的反向 Index,和 ...

  8. PCAP过滤器

    PCAP-FILTER NAME pcap-filter-packet filter syntax DESCRIPTION pcap_compile() 将字符串编译成过滤器程序. 合理的过滤器程序可 ...

  9. iptables rule

    和H3C中的acl很像,或者就是一会事,这就是不知道底层的缺陷,形式一变,所有的积累都浮云了 参考准确的说copy from http://www.ibm.com/developerworks/cn/ ...

随机推荐

  1. day26-python之封装

    1.动态导入模块 # module_t=__import__('m1.t') # print(module_t) # module_t = __import__('m1.t') # print(mod ...

  2. SAP ABAP的CI/CD解决方案

    如今国外很多partners已经在尝试Jenkins + abapGit + 公有云搭建ABAP CI/CD环境了.ABAP系统的改动通过abapGit提交,触发Jenkins上部署的命令行脚本,脚本 ...

  3. Python——输入&输出

    输入:input 在网页中有很多需要输入的点,比如:评论,用户名密码等等,这些功能在python中使用的是input模块来实现的. username = input('请输入用户名:') passwo ...

  4. OpenCV和ffmpeg编码资料分享

    本博也是在进行视频转码的学习道路上,也只是菜鸟一枚,收集了大量的资料,想在这和同路人分享一下 在博园里我发表一个JavaCV的随笔,里面介绍了JavaCV这个框架,它整合了OpenCV和ffmpeg等 ...

  5. Linux GRUB手动安装方法详解

    需要手工安装 GRUB 主要有两种情况: Linux 系统原先不是使用 GRUB 作为引导程序而现在想要使用 GRUB 来作为引导程序: MBR 中的引导程序被覆盖,需要在 MBR 中重新安装 GRU ...

  6. CentOS7.5安装python-pip报Error: Nothing to do解决方法

    python中的一个十分好用的包管理工具python-pip是我们使用python必不可少的一件工具.但是在CentOS7安装时候却报Error: Nothing to do: [root@bnsf- ...

  7. 常见EMC疑问及对策

    1. 在电磁兼容领域,为什么总是用分贝(dB)的单位描述?10mV是多少dBmV? 答:因为要描述的幅度和频率范围都很宽,在图形上用对数坐标更容易表示,而dB就是用对数表示时的单位,10mV是20dB ...

  8. ET·ci — 全自动软件测试调度(持续集成)平台

            ET·ci 提供了编译-测试-发布解决方案,包括:自动提取配置库代码进行自动构建, 自动调度静态测试工具(如QAC)进行静态测试,自动调度单元测试工具(如Tessy)开展动态测试,自动 ...

  9. 什么情况下使用large training data会非常有效

    收集大量的数据可能比算法的优劣更重要 Banko和Brill在2001年做了一个研究,是关于在句子中对易混单词进行识别,画出了上图的右边的那个图,这个图显示了对于不同的算法,它们的表现相似,但是随着t ...

  10. oracle删除重复数据,只保留一条

    比如,某个表要按照id和name重复,就算重复数据 delete from 表名 where rowid not in (select min(rowid) from 表名 group by id,n ...