question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

CPU usage 100% when use Key_Shared

See original GitHub issue

Describe the bug When use Key_Shared, if one consumer consume slowly and others are normal, MessageRedeliveryController#messagesToRedeliver will keep growing and could be very large.

MessageRedeliveryController#getMessagesToReplayNow will be very expensive cause messagesToRedeliver.items() is a O(n) operation in both time and space complexity. https://github.com/apache/pulsar/blob/2b2e0c50183c71e954f5c6e8bfcd7e36130279a5/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/MessageRedeliveryController.java#L109-L122

In this situation, one thread cpu usage could be 100%, this could effects the publish latency of other topics on the same broker instance.

To Reproduce Steps to reproduce the behavior:

  1. start a standalone cluster
  2. start a producer
$ bin/pulsar-perf produce -mk random persistent://public/default/test
  1. start a slow consumer and a normal consumer
$ bin/pulsar-perf consume -st Key_Shared persistent://public/default/test
$ bin/pulsar-perf consume -st Key_Shared -r 0.1 persistent://public/default/test

Screenshots CPU flame graph image

Additional context

  • pulsar: 2.8.1

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:10 (9 by maintainers)

github_iconTop GitHub Comments

3reactions
codelipenghuicommented, Dec 5, 2022
0reactions
zhanghaoucommented, Dec 5, 2022

@codelipenghui OK, thanks.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Fix High CPU Usage - Intel
Find out all the reasons why your PC displays high CPU usage. Our step-by-step guide will show you how to fix your CPU...
Read more >
8 Useful Solutions to Fix Your CPU 100% in Windows 10/11
Sometimes your CPU is running at 100% and the speed of your computer becomes slow. This post will provide 8 solutions for you...
Read more >
How to Fix High CPU Usage in Windows - AVG
Long-term high CPU usage (say 90-100%) can cause computer freezes & crashes. Find the cause and fix high CPU usage on Windows today....
Read more >
How to Lower CPU Usage - NinjaOne
What this article will cover: Why is my computer showing 100% CPU usage? What are common fixes for high CPU use? How to...
Read more >
How To FIX High CPU Usage on Windows 10 - YouTube
How to Fix High RAM/Memory Usage on Windows 10: https://www.youtube.com/watch?v=osKnDbHibig&t=0s How to Fix High Disk Usage on Windows 10: ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found