Segregate operations that read data from operations that update data by using separate interfaces. This pattern can maximize performance, scalability, and security; support evolution of the system over time through higher flexibility; and prevent upd…
CQRS The CQRS pattern and event sourcing are not mere simplistic solutions to the problems associated with large-scale, distributed systems. 从1000万用户并发修改用户资料的假设场景开始 每次修改操作耗时200ms,每秒5个操作 MySQL连接数在5K,分10个库 5 *5k *10=25万TPS 1000万/25万=40s 在秒杀场景中,由于对乐观锁/悲…
Chain of Responsibility定义:Chain of Responsibility(CoR) 是用一系列类(classes)试图处理一个请求request,这些类之间是一个松散的耦合,唯一共同点是在他们之间传递request.也就是说,来了一个请求,A类先处理,如果没有处理,就传递到B类处理,如果没有处理,就传递到C类处理,就这样象一个链条(chain)一样传递下去. 如何使用责任链模式 虽然这一段是如何使用CoR,但是也是演示什么是CoR. 有一个Handler接口: publ…