Giter VIP home page Giter VIP logo

Comments (4)

dongeforever avatar dongeforever commented on August 15, 2024

https://help.aliyun.com/document_detail/59998.html?spm=5176.doc49319.6.609.3GoMgx
这里有关于Kafka分区顺序的说明

from aliware-kafka-demos.

dongeforever avatar dongeforever commented on August 15, 2024

分区顺序
单个分区内,消息是按照发送顺序储存的,是基本有序的。 但云上 Kafka 并不保证单个分区内绝对有序,所以在某些情况下,会发生少量消息乱序,比如: 云上 Kafka 为了提高可用性,某个分区挂掉后把消息 failover 到其它分区。

from aliware-kafka-demos.

dongeforever avatar dongeforever commented on August 15, 2024

你是什么业务场景呢,需要使用分区顺序?

from aliware-kafka-demos.

milu2003 avatar milu2003 commented on August 15, 2024

好像这里指的分区跟我所理解的分区不一样。

比如这里提到的:https://help.aliyun.com/document_detail/49319.html?spm=5176.doc29537.6.566.xBDPnV

MQ 分区顺序消息适用于如下场景:

性能要求高,以 sharding key 作为分区字段,在同一个区块中严格的按照 FIFO 原则进行消息发布和消费的场景。


举例说明:

【例一】用户注册需要发送发验证码,以用户 ID 作为 sharding key, 那么同一个用户发送的消息都会按照先后顺序来发布和订阅。

【例二】电商的订单创建,以订单 ID 作为 sharding key,那么同一个订单相关的创建订单消息、订单支付消息、订单退款消息、订单物流消息都会按照先后顺序来发布和订阅。

阿里巴巴集团内部电商系统均使用此种分区顺序消息,既保证业务的顺序,同时又能保证业务的高性能。

最近用到消息队列,之前用redis做消息队列,目前qps达到2万多,感觉出现了瓶颈。
去阿里云看消息队列的相关产品,发现有nodejs的SDK的,就只有Kafka了。所以目前了解一下Kafka。但是出现了不少疑问。

我的应用场景是这样的。

有多个任务,每个任务都有队列

任务A,可能有200万队列
任务B,可能有1万队列
任务C,可能有15万队列

不是按顺序消费的。比如根据一定的条件,优先消费任务C,也有可能优先消费任务B,所以,这时候,这些队列最好能分组存储,按分组消费。我看见阿里云的后台,每次生产一个消息,都可以添加tag,但是我又不知道怎么根据tag去查询这些消息。

还有一种情况,当用户取消了任务B,要有一定的清理机制,最好能让我直接把某个tag下面的任务队列全清除了。

from aliware-kafka-demos.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.