distribution system index
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的更多相关文章
- 有个奇怪的问题,配置成/system/index,jsp页面时没有经过过滤器进行拦截,而配置成redirectAction时是可以直接跳转刀片loginJsp.action
有个奇怪的问题,配置成/system/index,jsp页面时没有经过过滤器进行拦截,而配置成redirectAction时是可以直接跳转刀片loginJsp.action 但是我直接访问/syste ...
- C# 中 System.Index 结构体和 Hat 运算符(^)的全新用法
翻译自 John Demetriou 2019年2月17日 的文章 <C# 8 – Introducing Index Struct And A Brand New Usage For The ...
- File System Design Case Studies
SRC=http://www.cs.rutgers.edu/~pxk/416/notes/13-fs-studies.html Paul Krzyzanowski April 24, 2014 Int ...
- magento cache,magento index
"Magento后台作修改,Magento前台没变化""Magento属性更新了,Magento前台没反应"如果你碰到了以上两种情况,或者看到截图中的提示: 您 ...
- C# 中 System.Range 结构体
翻译自 John Demetriou 2020年4月6日 的文章 <C# 8 Is Introducing Ranges> 我们之前讨论过的 C# 中的一个特性 System.Index ...
- 说说C# 8.0 新增功能Index和Range的^0是什么?
前言 在<C# 8.0 中使用 Index 和 Range>这篇中有人提出^0是什么意思?处于好奇就去试了,结果抛出异常.查看官方文档说^0索引与 sequence[sequence.Le ...
- C# 使用 Index 和 Range 简化集合操作
C# 使用 Index 和 Range 简化集合操作 Intro 有的语言数组的索引值是支持负数的,表示从后向前索引,比如:arr[-1] 从 C# 8 开始,C# 支持了数组的反向 Index,和 ...
- PCAP过滤器
PCAP-FILTER NAME pcap-filter-packet filter syntax DESCRIPTION pcap_compile() 将字符串编译成过滤器程序. 合理的过滤器程序可 ...
- iptables rule
和H3C中的acl很像,或者就是一会事,这就是不知道底层的缺陷,形式一变,所有的积累都浮云了 参考准确的说copy from http://www.ibm.com/developerworks/cn/ ...
随机推荐
- self attention pytorch代码
实现细节; 1.embedding 层 2.positional encoding层:添加位置信息 3,MultiHeadAttention层:encoder的self attention 4,sub ...
- hybris commerce storefront的产品搜索功能
在Hybris Commerce Cloud的storefront的搜索栏键入一些字母,每次键入,会触发一个发送到后台的http请求实现live search的功能: http url如下:https ...
- SpringBoot学习<一>——快速搭建SpringBoot
这是我的第一篇博客,博客记录我以后的学习,包括一些总结之类的东西,当然,这些记录是针对于与我个人而言的,可能有些地方会有不好的,或者出现错误,欢迎大家来指正(如果有人看的话)废话不多说.进入正题:Sp ...
- Springboot默认定时任务——Scheduled注解
1.pom配置 <dependencies> <dependency> <groupId>org.springframework.boot</groupId& ...
- python面试总结3(性能分析优化,GIl常考题)
python性能分析和优化,GIL常考题 什么是Cpython GIL Cpython解释器的内存管理并不是线程安全的 保护多线程情况下对python对象访问 Cpython使用简单的锁机制避免多个线 ...
- 一个97年测试妹纸的成长经历,转正直接涨薪2K
这篇文章,涉及测试团队管理.测试流程建设.测试从业者能力成长.优秀测试从业者的状态.以及同样是两年的Tester,为何他人如此优秀 . 一切的一切,都是有原因的 . 期望这篇文章,对关注「简尚」公号的 ...
- yum 异常解决一例
http://mirrors.cloud.aliyuncs.com/centos/6/os/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 22 ...
- 51nod 2387 戴德兰
牛牛非常喜欢赶deadline.输入n, c, d一共有n个任务,第i个任务需要a[i]分钟完成 特别的,在最后d分钟,牛牛的效率会变成双倍(耗时变为一半) 可能出现一个任务前半部分不在最后d分钟,后 ...
- java -static的特性和使用,静态类/方法/块/内部类/回收机制
mark一下,今天的作业. java-core P115 如果将域定义为static,每个类中只有一个这样的域.(这里的域应该是指一片物理数据空间,而不是单纯的指代某一个变量,而是静态域). publ ...
- mysql占用内存过高调优方法
最近测试一个站点,用mysql 5.6+mencache 内存16GB,但是进行查询的时候还是导致CPU占用过高,达到80%左右,所以想办法如何进行调优.以下几个参数进行参考选择 优化mysql数据 ...