-
Notifications
You must be signed in to change notification settings - Fork 189
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
v0.12 appendOrMergeRPC inefficiency #581
Comments
Care for a patch? This was recently changed. cc @MarcoPolo |
Hi, thanks for investigating this. Is the 14% TPS drop something you noticed in production or doing a local stress test? The n^2 issue was known to me, but it was preferred as the simpler solution. The alternative is not a simple addition. This is a protobuf with a varint encoding for the length prefix, which means that when you cross certain boundaries the length prefix will increase by a byte. For example when the size increases from 127 to 128 the length prefix value goes from The actual solution would involve this code being aware of the Protobuf encoding to catch that edge case. An alternative and slightly hacky solution would be to assume that all length prefixes are at most 8 bytes. If you're keen to submit a patch I'd prefer the hacky solution as it is likely less brittle than trying to be aware of the pb encoding. |
that sounds reasonable actually, not all that hacky! |
It was a load single DC test. We are going into production with 0.10 this week.
Exactly, that's why it is an issue and not a pull request.
I agree, small possible over estimation should be tolerable here. I'll try one next days and report back. |
I published a draft (it is not working as expected in gaining performance, investigating) but want to make sure we are aligned in the approach. |
Summary
I've been running some performance tests and discovered the following:
doValidateTopic
is blocked on a channelv.p.sendMsg <- msg
for log time (from block profile):processLoop
method, this meansprocessLoop
is not fast enough anymore. Here are excerpts:handleIncomingRPC
boils down toappendOrMergeRPC
that is accountable for 11/17=64% of a timeIt appears this loop with
lastRPC.Size()
call gives us n^2 complexity sincelastRPC.Size()
itself iterates overlastRPC.Publish
but we have not to because it was just appended and its size step back is known so it can be a simple addition.Impact
This appears to be responsible for 14% TPS lose after upgrading to v0.12.
The text was updated successfully, but these errors were encountered: