Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjust concurrent consume queue order #259

Merged
merged 1 commit into from
Jun 10, 2020

Conversation

rudy2steiner
Copy link
Collaborator

@rudy2steiner rudy2steiner commented Jun 2, 2020

  • 在并发消费时,重试队列和普通队列应当是一样的概率
  • 高优先级、重试队列没有消息时,继续尝试读普通队列

listIndex = partitionManager.selectPartitionIndex(partitionSize, listIndex + i, accessTimes);
short partition = partitionList.get(listIndex);
if(partition==Partition.RETRY_PARTITION_ID){
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

重试分区与普通分区有同样的概率被选中,会不会导致重试库压力过大并且拖慢并行消费的性能?

Copy link
Collaborator Author

@rudy2steiner rudy2steiner Jun 3, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

某次请求的轮询partition列表是否包含重试分区还有另外一个参数可以控制retry.random.bound.*,也即是说拉取重试消息的概率是可控制,理论上不会拖慢并行消费。新的改动可以解决的场景:

用户开启了并行,积压消息少或为零,重试消息多的场景,手动调大重试概率,保证轮询队列列表(大概率)包含重试队列

  • 积压消息为零,快速快速消费大量的重试消息
  • 突然有大量消息入队,大概率会拉取积压消息(普通队列数远大于重试队列数)

原实现在这种情况下,会一直(大概率)去消费重试队列,导致消息积压;
重试的压力主要表现在写上,读重试压力可以用缓存等方式解决

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks

@chengzl90 chengzl90 merged commit d18bc6f into jd-opensource:master Jun 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants