在微服务架构中,消息队列带来哪些好处呢
1. 改善写操作请求的响应时间:生产者写给队列即可返回,无需等待下游服务响应,缩短链路调用时间
2. 更容易进行伸缩:小功能解偶为独立服务,更容易伸缩,提升处理能力
3. 削峰填谷:控制消费速度,降低系统访问高峰压力
4. 隔离失败:消费者处理消息失败,不会传递给生产者
5. 降低耦合:上下游服务解藕
6. 保证最终一致性
多个消息生产者向消息队列发送消息,多个消费者消费消息,每个消息只会被一个消费者消费
多个消息消费者可以订阅同一个主题,每个消费者都可以收到这个主题的消息拷贝,然后按照自己的业务逻辑分别进行处理计算
Apache ActiveMQ® is the most popular open source, multi-protocol, Java-based message broker.
Apache RocketMQ™ is a unified messaging engine, lightweight data processing platform.
RabbitMQ is lightweight and easy to deploy on premises and in the cloud. It supports multiple messaging protocols. RabbitMQ can be deployed in distributed and federated configurations to meet high-scale, high-availability requirements.
Apache Kafka is an open-source distributed event streaming platform used by thousands of companies for high-performance data pipelines, streaming analytics, data integration, and mission-critical applications.
网上常见的对比:
从不同使用场景对比下Kafka、 RabbitMQ
RabbitMQ is the most widely deployed open source message broker.
More than 80% of all Fortune 100 companies trust, and use Kafka.
Flexible & Powerful Open Source Multi-Protocol Messaging
Apache RocketMQ™ is a unified messaging engine, lightweight data processing platform.