-
Notifications
You must be signed in to change notification settings - Fork 627
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
Improve performance #654
Improve performance #654
Conversation
My opinion is that for this type of code you should write something yourself, which you know is fully optimized. This is protocol level and will not be changed often. However, BufferList looks quite good. |
Awesome @crzidea! Looking forward to testing this! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a definite difference in performance.
Single consumer consuming 2.1 million messages:
30 partitions
before: 154s
after: 150s
1 partition
before: 194s
after: 189s
👏🏻
I will Merge this PR and start working on |
@hyperlink The difference in performance would be more convincing if you test on large messages. |
Buffer#slice()
in node is extremely slow and should avoid using it! Unfortunately, we didn't realize it when create this project. So, we should have a plan to improve the performance of this module:BufferList
(bl) instead of raw Buffer to avoid callingBuffer#slice()
.I have a patch for this module, and tested it in production. In my case, I have reduced CPU usage from 70% to 50%, and memory usage from 400m to 200m, and increased throughput from 200k/min to 400k/min.
binary
module. The module is 5 years old and have not be maintained for 5 years!kafka-node
is heavily depended onbinary
but unfortunatelybinary
usedBuffer#slice()
, a lot.This patch complete
Step 1
, and I hope someone else could help me with theStep 2
.