Netflix Tudum 架构:从 CQRS 与 Kafka 到 CQRS 与 RAW Hollow
The high-level diagram above focuses on storage & distribution, illustrating how we leveraged Kafka to separate the write and read databases. The write database would store internal page content and metadata from our CMS. The read database would store read-optimized page content, for example: CDN image URLs rather than internal asset IDs, and movie titles, synopses, and actor names instead of placeholders. This content ingestion pipeline allowed us to regenerate all consumer-facing content on demand, applying new structure and data, such as global navigation or branding changes. The Tudum Ingestion Service converted internal CMS data into a read-optimized format by applying page templates, running validations, performing data transformations, and producing the individual content elements into a Kafka topic. The Data Service Consumer, received the content elements from Kafka, stored them in a high-availability database (Cassandra), and acted as an API layer for the Page Construction service and other internal Tudum services to retrieve content.
上面的高层次图示关注于存储和分发,说明我们如何利用 Kafka 来分离写数据库和读数据库。写数据库将存储来自我们 CMS 的内部页面内容和元数据。读数据库将存储读优化的页面内容,例如:CDN 图像 URL 而不是内部资产 ID,以及电影标题、简介和演员姓名而不是占位符。这个内容摄取管道使我们能够按需重新生成所有面向消费者的内容,应用新的结构和数据,例如全局导航或品牌更改。Tudum 摄取服务通过应用页面模板、运行验证、执行数据转换,并将单个内容元素生成到 Kafka 主题中,将内部 CMS 数据转换为读优化格式。数据服务消费者从 Kafka 接收内容元素,将其存储在高可用性数据库(Cassandra)中,并充当页面构建服务和其他内部 Tudum 服务检索内容的 API 层。
A key advantage of decoupling read and write paths is the ability to scale them independently. It is a well-known architectural approach to connect both write and read databases using an event driven architecture. As a result, content edits would eventually appear on tudum.com.
解耦读写路径的一个关键优势是能够独立扩展它们。这是一种众所周知的架构方法,通过事件驱动架构连接写数据库和读数据库。因此,内容编辑将 最终 出现在 tudum.com 上。
Challenges with eventual consistency
最终一致性面临的挑战
Did you notice the emphasis on “eventually?” A major downside of this architecture was the delay between making an edit and observing that edit reflected on the website. For instance, when the team publishes an update, the following ...