mirror of
https://github.com/cheetahlou/CategoryResourceRepost.git
synced 2025-10-16 06:53:44 +08:00
26 KiB
26 KiB
要学好分布式架构,你首先需要学习一些架构指导性的文章和方法论,即分布式架构设计原则。下面是几篇很不错的文章,值得一读。
设计模式
有了方法论后,你还需要学习一些比较细节的落地的技术。最好的方式就是学习被前人总结出来的设计模式,虽然设计模式也要分场景,但是设计模式可以让你知道一些套路,这些套路对于我们设计的分布式系统有非常大的帮助,不但可以让我们少走一些弯路,而且还能让我们更为系统和健壮地设计我们的架构。
下面是一些分布式架构设计模式的网站。
首先,需要重点推荐的是微软云平台 Azure 上的设计模式。 Cloud Design Patterns ,这个网站上罗列了分布式设计的各种设计模式,可以说是非常全面和完整。对于每一个模式都有详细的说明,并有对其优缺点的讨论,以及适用场景和不适用场景的说明,实在是一个非常不错的学习分布式设计模式的地方。其中有如下分类。
除此之外,还有其它的一些关于分布式系统设计模式的网站和相关资料。
我个人觉得微服务也好,SOA也好,都是分布式系统的一部分,这里有两个网站罗列了各种各样的服务架构模式。
当然,还有我在极客时间上写的那些分布式的设计模式的总结。
设计与工程实践
分布式系统的故障测试
弹性伸缩
-
- [Autoscaling Pinterest](https://medium.com/@Pinterest_Engineering/auto-scaling-pinterest-df1d2beb4d64);
- [Square: Autoscaling Based on Request Queuing](https://medium.com/square-corner-blog/autoscaling-based-on-request-queuing-c4c0f57f860f);
- [PayPal: Autoscaling Applications](https://medium.com/paypal-engineering/autoscaling-applications-paypal-fb5bb9fdb821);
- [Trivago: Your Definite Guide For Autoscaling Jenkins](http://tech.trivago.com/2017/02/17/your-definite-guide-for-autoscaling-jenkins/);
- [Scryer: Netflix’s Predictive Auto Scaling Engine](https://medium.com/netflix-techblog/scryer-netflixs-predictive-auto-scaling-engine-a3f8fc922270)。
- [Consistent Hashing](http://www.tom-e-white.com/2007/11/consistent-hashing.html) ,这是一个一致性哈希的简单教程,其中还有代码示例。
- [Consistent Hashing: Algorithmic Tradeoffs](https://medium.com/@dgryski/consistent-hashing-algorithmic-tradeoffs-ef6b8e2fcae8) ,这篇文章讲述了一致性哈希的一些缺陷和坑,以及各种哈希算法的性能比较,最后还给了一组代码仓库,其中有各种哈希算法的实现。
- [Distributing Content to Open Connect](https://medium.com/netflix-techblog/distributing-content-to-open-connect-3e3e391d4dc9) ,Netflix的一个对一致性哈希的实践,提出了Uniform Consistent Hashing,是挺有意思的一篇文章。
- [Consistent Hashing in Cassandra](https://blog.imaginea.com/consistent-hashing-in-cassandra/) ,这是Cassandra中使用到的一致性哈希的相关设计。
- [Life Beyond Distributed Transactions](https://queue.acm.org/detail.cfm?id=3025012) ,该文是Salesforce的软件架构师帕特·赫兰德(Pat Helland)于2016年12月发表的针对其在2007年CIDR(创新数据库研究会议)上首次发表的同名文章的更新和缩写版本。业界谈到分布式事务通常指两段提交2PC事务(Spring/JEE中JTA等)或者Paxos与Raft,这些事务都有明显缺点和局限性。 而赫兰德在本文讨论的是另外一种基于本地事务情况下的事务机制,它是基于实体和活动(Activity)的概念,其实类似DDD聚合根和领域事件的概念,这种工作流类型事务虽然需要程序员介入,依靠消息系统实现,但可以实现接近无限扩展的大型系统。赫兰德文中提出了重要的观点:“如果你不能使用分布式事务,那么你就只能使用工作流。”
- [How Sharding Works](https://medium.com/@jeeyoungk/how-sharding-works-b4dec46b3f6) ,这是一篇很不错的探讨数据Sharding的文章。基本上来说,数据Sharding可能的问题都在这篇文章里谈到了。
- [Why you don’t want to shard](https://www.percona.com/blog/2009/08/06/why-you-dont-want-to-shard/) ,这是Percona的一篇文章,其中表达了,不到万不得已不要做数据库分片。是的,最好还是先按业务来拆分,先把做成微服务的架构,然后把数据集变简单,然后再做Sharding会更好。
- [How to Scale Big Data Applications](https://www.percona.com/sites/default/files/presentations/How%20to%20Scale%20Big%20Data%20Applications.pdf) ,这也是Percona给出的一篇关于怎样给大数据应用做架构扩展的文章。值得一读。
- [MySQL Sharding with ProxySQL](https://www.percona.com/blog/2016/08/30/mysql-sharding-with-proxysql/) ,用ProxySQL来支撑MySQL数据分片的一篇实践文章。
- [缓存更新的套路](https://coolshell.cn/articles/17416.html),这是我在CoolShell上写的缓存更新的几个设计模式,包括Cache Aside、Read/Write Through、Write Behind Caching。
- [Design Of A Modern Cache](http://highscalability.com/blog/2016/1/25/design-of-a-modern-cache.html) ,设计一个现代化的缓存系统需要注意到的东西。
- [Netflix: Caching for a Global Netflix](https://medium.com/netflix-techblog/caching-for-a-global-netflix-7bcc457012f1) ,Netflix公司的全局缓存架构实践。
- [Facebook: An analysis of Facebook photo caching](https://code.facebook.com/posts/220956754772273/an-analysis-of-facebook-photo-caching/) ,Facebook公司的图片缓存使用分析,这篇文章挺有意思的,用数据来调优不同的缓存大小和算法。
- [How trivago Reduced Memcached Memory Usage by 50%](https://tech.trivago.com/2017/12/19/how-trivago-reduced-memcached-memory-usage-by-50/) ,Trivago公司一篇分享自己是如何把Memcached的内存使用率降了一半的实践性文章。很有意思,可以让你学到很多东西。
- [Caching Internal Service Calls at Yelp](https://engineeringblog.yelp.com/2018/03/caching-internal-service-calls-at-yelp.html) ,Yelp公司的缓存系统架构。
- [Understanding When to use RabbitMQ or Apache Kafka](https://content.pivotal.io/blog/understanding-when-to-use-rabbitmq-or-apache-kafka) ,什么时候使用RabbitMQ,什么时候使用Kafka,通过这篇文章可以让你明白如何做技术决策。
- [Trello: Why We Chose Kafka For The Trello Socket Architecture](https://tech.trello.com/why-we-chose-kafka/) ,Trello的Kafka架构分享。
- [LinkedIn: Running Kafka At Scale](https://engineering.linkedin.com/kafka/running-kafka-scale) ,LinkedIn公司的Kafka架构扩展实践。
- [Should You Put Several Event Types in the Same Kafka Topic?](https://www.confluent.io/blog/put-several-event-types-kafka-topic/) ,这个问题可能经常困扰你,这篇文章可以为你找到答案。
- [Billions of Messages a Day - Yelp’s Real-time Data Pipeline](https://engineeringblog.yelp.com/2016/07/billions-of-messages-a-day-yelps-real-time-data-pipeline.html) ,Yelp公司每天十亿级实时消息的架构。
- [Uber: Building Reliable Reprocessing and Dead Letter Queues with Kafka](https://eng.uber.com/reliable-reprocessing/) ,Uber公司的Kafka应用。
- [Uber: Introducing Chaperone: How Uber Engineering Audits Kafka End-to-End](https://eng.uber.com/chaperone/) ,Uber公司对Kafka消息的端到端审计。
- [Publishing with Apache Kafka at The New York Times](https://open.nytimes.com/publishing-with-apache-kafka-at-the-new-york-times-7f0e3b7d2077) ,纽约时报的Kafka工程实践。
- [Kafka Streams on Heroku](https://blog.heroku.com/kafka-streams-on-heroku) ,Heroku公司的Kafka Streams实践。
- [Salesforce: How Apache Kafka Inspired Our Platform Events Architecture](https://engineering.salesforce.com/how-apache-kafka-inspired-our-platform-events-architecture-2f351fe4cf63) ,Salesforce的Kafka工程实践。
- [Exactly-once Semantics are Possible: Here’s How Kafka Does it](https://www.confluent.io/blog/exactly-once-semantics-are-possible-heres-how-apache-kafka-does-it/) ,怎样用Kafka让只发送一次的语义变为可能。这是业界中一个很难的工程问题。
- [Delivering billions of messages exactly once](https://segment.com/blog/exactly-once-delivery/) 同上,这也是一篇挑战消息只发送一次这个技术难题的文章。
- [Benchmarking Streaming Computation Engines at Yahoo!](https://yahooeng.tumblr.com/post/135321837876/benchmarking-streaming-computation-engines-at)。Yahoo!的Storm团队在为他们的流式计算做技术选型时,发现市面上缺乏针对不同计算平台的性能基准测试。于是,他们研究并设计了一种方案来做基准测试,测试了Apache Flink、Apache Storm和Apache Spark这三种平台。文中给出了结论和具体的测试方案。(如果原文链接不可用,请尝试搜索引擎对该网页的快照。)
- [Using Logs to Build a Solid Data Infrastructure - Martin Kleppmann](https://www.confluent.io/blog/using-logs-to-build-a-solid-data-infrastructure-or-why-dual-writes-are-a-bad-idea/) ,设计基于log结构应用架构的一篇不错的文章。
- [Building DistributedLog: High-performance replicated log service](https://blog.twitter.com/engineering/en_us/topics/infrastructure/2015/building-distributedlog-twitter-s-high-performance-replicated-log-servic.html) ,Distributed是Twitter 2016年5月份开源的一个分布式日志系统。在Twitter内部已经使用2年多。其主页在 [distributedlog.io](http://distributedlog.io/)。这篇文章讲述了这个高性能日志系统的一些技术细节。另外,其技术负责人是个中国人,其在微信公众号中也分享过这个系统 [Twitter高性能分布式日志系统架构解析](https://mp.weixin.qq.com/s?__biz=MzAwMDU1MTE1OQ==&mid=403051208&idx=1&sn=1694ac05acbcb5ca53c88bfac8a68856&scene=2&srcid=1224xZuQ9QQ4sRmiPVdHTppL)。
- [LogDevice: a distributed data store for logs](https://code.facebook.com/posts/357056558062811/logdevice-a-distributed-data-store-for-logs/) ,Facebook分布式日志系统方面的一些工程分享。
- [Understand Latency](http://highscalability.com/latency-everywhere-and-it-costs-you-sales-how-crush-it) ,这篇文章收集并整理了一些和系统响应时间相关的文章,可以让你全面了解和Latency有关的系统架构和设计经验方面的知识。
- [Common Bottlenecks](http://highscalability.com/blog/2012/5/16/big-list-of-20-common-bottlenecks.html) ,文中讲述了20个常见的系统瓶颈。
- [Performance is a Feature](https://blog.codinghorror.com/performance-is-a-feature/) ,Coding Horror上的一篇让你关注性能的文章。
- [Make Performance Part of Your Workflow](https://codeascraft.com/2014/12/11/make-performance-part-of-your-workflow/) ,这篇文章是图书《[Designing for Performance](http://shop.oreilly.com/product/0636920033578.do)》中的节选(国内没有卖的),其中给出来了一些和性能有关的设计上的平衡和美学。
- [CloudFlare: How we built rate limiting capable of scaling to millions of domains](https://blog.cloudflare.com/counting-things-a-lot-of-different-things/),讲述了CloudFlare公司是怎样实现他们的限流功能的。从最简单的每客户IP限流开始分析,进一步讲到anycast,在这种情况下PoP的分布式限流是怎样实现的,并详细解释了具体的算法。
- Instagram: Search Architecture
- eBay: The Architecture of eBay Search
- eBay: Improving Search Engine Efficiency by over 25%
- LinkedIn: Introducing LinkedIn’s new search architecture
- LinkedIn: Search Federation Architecture at LinkedIn
- Slack: Search at Slack
- DoorDash: Search and Recommendations at DoorDash
- Twitter: Search Service at Twitter (2014)
- Pinterest: Manas: High Performing Customized Search System
- Sherlock: Near Real Time Search Indexing at Flipkart
- Airbnb: Nebula: Storage Platform to Build Search Backends
- YouTube Architecture
- Scaling Pinterest
- Google Architecture
- Scaling Twitter
- The WhatsApp Architecture
- Flickr Architecture
- Amazon Architecture
- Stack Overflow Architecture
- Pinterest Architecture
- Tumblr Architecture
- Instagram Architecture
- TripAdvisor Architecture
- Scaling Mailbox
- Salesforce Architecture
- ESPN Architecture
- Uber Architecture
- Dropbox Design
- Splunk Architecture
- 入门篇
一致性哈希
数据库分布式
缓存
消息队列
关于日志方面
关于性能方面
关于搜索方面
各公司的架构实践
High Scalability ,这个网站会定期分享一些大规模系统架构是怎样构建的,下面是迄今为止各个公司的架构说明。
小结
今天我们分享的内容是高手成长篇分布式架构部分的最后一篇——分布式架构工程设计,讲述了设计原则、设计模式等方面的内容,尤其整理和推荐了国内外知名企业的设计思路和工程实践,十分具有借鉴意义。
下篇文章中,我们将分享微服务架构方面的内容。敬请期待。
下面是《程序员练级攻略》系列文章的目录。