去年总结了亚麻和灭他的设计题,这次把地里看到的谷歌设计题整理一下。
2023年 亚麻半年设计和BQ
https://www.1point3acres.com/bbs/thread-1016786-1-1.html
2023年 灭他系统设计半年总结
https://www.1point3acres.com/bbs/thread-1016549-1-1.html
因为分数原因,有足够分数的同学可以贴一下题目。我会根据经验进行解读。
要求设计一个分布式缓存
https://www.1point3acres.com/bbs/thread-1096436-1-1.html
在领英找了一个比较详细的 例子,然后用Chat GPT Highlight,中文是我的解读。 https://www.infoq.com/articles/netflix-global-cache/
Building a Global Caching System at Netflix: A Deep Dive into Global Replication
Key Takeaways
• Global Replication Strategy: Netflix replicates data across four regions, reducing latency and enhancing reliability during regional outages.
• EVCache Caching: EVCache, a distributed key-value store on SSDs, enables linear scalability and resilience, managing huge data volumes.
• Infrastructure Scale: EVCache includes 200 clusters and 22,000 servers, handling 30 million global replication events, 400 million operations per second, and storing around 2 trillion items totaling 14.3 petabytes.
• Client-Initiated Replication: The topology-aware EVCache client manages data routing, reducing server load and supporting flexible replication.
• Efficiency Improvements: Batch compression and a switch to Eureka DNS for service discovery have reduced network costs, enhancing performance.
缓存服务器常见的有Memcached和Redis,Redis更轻量级,适用小数据,比如Json/String。Memcached更适用大文件,比如短视频。这应该是Netflix选择Memcached原因,因为有些视频,比如短视频影片预告需要进行缓存。
(1)replicates在大数据存储比较普遍,主要是用于灾难备份。比如世贸中心被袭击了,整个数据中心没了,要访问哪里?另外本地的访问可以链到本地的Region,速度更快。比如硅谷访问东岸Region(East 1),纽约访问东岸Region(West 2)。(2)EVCache Key-Value指的是类似Hash MAP这种数据结构,可以实现O(1)的访问速度,在各种No-SQL普遍运用,如Cassandra,Redis。(3)4亿的访问量,2万2的服务器,每个服务器平均18 requests/milisecond,这个量还是蛮大的。没有测过Memcached,做过的同学可以提供一下参数。(4)Topology-Aware Client,记录物理位置(比如那个数据中心,那个机架?)和虚拟位置,还有通过Get Health来获得服务器的实时状态。(5)Eureka DNS用来取代Load Balance,减少Cost。文中没有给出设计逻辑。普通的NLB问题是不管访问速度,比如NGINX,只是随机分发Request。如果某个服务器(群)Response 很慢,它是不管的。估计Eureka带进了解决方案。https://github.com/bfg/eureka-dns-server
Introduction
In the global entertainment landscape, Netflix focuses on maintaining data availability across regions to offer a smooth user experience. Distributed caching through EVCache is key to achieving high availability and performance.
这个图,我的理解是US West 2是故障(Fail over)Region,原来数据是有的,因为某些Server Down了之类的原因,数据没了。Client应该是在West 2,Request被转到US EAST 1,然后把数据从East 1 的 Reader,写到 West 2的Writer,以便让访问更快。数据应该在EVCache Servers,Reader/Writer应该是logical Module。
EVCache: Backbone of Netflix’s Caching
EVCache (Ephemeral Volatile Cache) is Netflix’s customized Memcached-based, SSD-backed solution providing scalability and resilience. EVCache spans 200 clusters across four regions, supporting diverse applications with over 22,000 servers.
Key Features of EVCache
• Global Replication: Ensures cross-region data access.
• Topology-Aware Client: Optimizes data storage and retrieval.
• Resilience: Withstands failures across vari您好! 本帖隐藏的内容需要积分高于 188 才可浏览 您当前积分为 0。 使用VIP即刻解锁阅读权限或查看其他获取积分的方式 游客,您好! 本帖隐藏的内容需要积分高于 188 才可浏览 您当前积分为 0。 VIP即刻解锁阅读权限 或 查看其他获取积分的方式 ents
• Batch Compression: Reduced network bandwidth by 35%.
• Removing Load Balancers: Shifted from NLBs to Eureka DNS for routing, reducing network costs by 50%.
跨Region的Request,用了Batch Compression,毕竟从东岸到西岸比较远。
Conclusion
Netflix’s global caching solution, driven by EVCache and client-initiated replication, provides a scalable, low-latency infrastructure. Ongoing improvements in replication efficiency, data availability, and cost management ensure Netflix’s infrastructure supports seamless user experiences worldwide.
总结一下,EVCache部署在AWS的环境,Instance/Network都很贵。文中给出了一些Solution,来减少Cost。比如Eureka DNS。 欢迎大家给出不同的解读,有问题可以留言。 |