Skip to Content
构建可扩展分布式系统:方法与实践
book

构建可扩展分布式系统:方法与实践

by Ian Gorton
May 2024
Intermediate
278 pages
5h 24m
Chinese
China Machine Press
Content preview from 构建可扩展分布式系统:方法与实践
124
|
7
在代理中,每个队列由单个线程管理。这意味着,如果底层节点上的队列数至少与核心
数一样多,那么可以提高多核节点上的吞吐量。相反,如果你的代理节点上高利用率队
列数远比核心数多,那么你可能会遇到一些性能下降。
与大多数消息代理一样,
RabbitMQ
在消费速率跟生产速率相当时表现最佳。当队列增
长到大约有数万条消息时,管理队列的线程将承受更多的开销。默认情况下,代理使用
运行节点
40%
的可用内存。当达到此限制时,代理将开始限制生产者,降低代理接受消
息的速度,直到内存使用率降至
40%
阈值以下。内存阈值是可配置的,它是一个可以根
据你的工作负载进行调整以优化消息吞吐量的设置
5
1
7.2.3
数据安全与性能权衡
所有消息传递系统都面临着性能与可靠性权衡的两难境地。在这种特殊情况下,核心问
题是消息传递的可靠性,通常称为数据安全。你希望自己的消息在生产者和消费者之间
以最小的延迟传输,当然你也不希望在此过程中丢失任何消息。然而要是真有这么简单
就好了。可别忘了,这些是分布式系统。
当一条消息从生产者传递到消费者时,你必须在设计中考虑多种故障场景。其包括:
生产者向代理发送消息,但代理未成功接受该消息。
消息在队列中的时候代理崩溃了。
消息已成功传递给消费者,但消费者在完全处理该消息之前出故障了。
如果你的应用程序能够容忍消息丢失,那么你可以选择性能最大化的选项。如果偶尔丢
失一条来自即时消息传递应用程序的消息,那么这可能并不重要。在这种情况下,你的
系统可以忽略消息安全问题并全速运行。但采购系统就不一样 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

What Successful Brick-and-Mortar Retailers Get Right

What Successful Brick-and-Mortar Retailers Get Right

Rob Angell
What Successful Project Managers Do

What Successful Project Managers Do

W. Scott Cameron, Jeffrey S. Russell, Edward J. Hoffman, Alexander Laufer
Three Essentials for Agentic AI Security

Three Essentials for Agentic AI Security

Paolo Dal Cin, Daniel Kendzior, Yusof Seedat, Renato Marinho

Publisher Resources

ISBN: 9787111750697