-
Notifications
You must be signed in to change notification settings - Fork 60
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
Remove additional bytestring conversion. #125
base: master
Are you sure you want to change the base?
Conversation
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.
The previous change to that line was
- encoded = Lazy.fromChunks [ Strict.copy $ Put.runPut (safePut object) ]
+ encoded = Lazy.fromChunks [ Strict.copy $ Lazy.toStrict $
+ serialiserEncode (logSerialiser (logIdentifier fLog)) object ]
It is hard to see how this change wouldn't be an improvement.
This is patch where the copy was originally added. But I am not sure why it was added, What purpose could that Or maybe without it there is too much laziness and things are not durable when they are supposed to be? Clearly that It does seem like we would not need both |
Maybe @lemmih could chime in (if he's not too busy with LHC) as to the motivation of introducing |
The encoder would allocate a minimum of something like 32KB which would kill performance for small events. Copying small objects yielded a more than 10x speed improvement but it's not a great thing to do for large checkpoints. If the serialization library can be configured to use a smaller initial buffer then the copying can just be removed with no ill effects. |
Maybe we should do an A-Bump, merge everything, and let the chips fall where they may? |
Previous comment doesn't sound so great now that I'm rereading it. |
Sorry for neglecting this for so long. I think we should drop the copy, because it clearly hurts heap usage a lot with large checkpoints. I don't fully understand why the copying helped, but it sounds like the issue is that the |
I think the problem here is that we have no suitable benchmark/testsuite to help give us confidence that this improves things more than it hurts things. |
Agreed. I've actually been looking at this a little recently, and started some work on improving the existing benchmarks, which is currently at It's fairly clear that this change can bring down memory usage substantially when checkpoints are large. That alone would make it worth including for my use case, where we don't see high enough loads to be too worried about throughput. However, it is harder to assess the impact on throughput from the existing Another thing that could be nice is benchmarking a server that uses |
When performing a checkpoint, the heap gets very large (eye balling with
ekg
). I think the additionalBytestring
copying is to blame. Do we need to copy the bytestring? I think it gets copied twice, once with the strict conversion, and again with the call tocopy
.cc @adamgundry @stepcut @lemmih @cleverca22