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

StreamQueue: only unmap unused segments #557

Merged
merged 7 commits into from
Sep 8, 2023
Merged

Conversation

carlhoerberg
Copy link
Member

Previous behavior could unmap segments that other consumers were still delivering from, causing segfaults.

@carlhoerberg
Copy link
Member Author

Don't like the 60s sleep.. I think we can do better than that. Maybe a channel that consumers can notify when they switch segment.

@carlhoerberg carlhoerberg marked this pull request as draft August 9, 2023 19:38
@viktorerlingsson
Copy link
Member

Don't like the 60s sleep.. I think we can do better than that. Maybe a channel that consumers can notify when they switch segment.

A channel that consumers notify when switching segments sounds good to me.

Should we unmap on consumer disconnect as well?

@carlhoerberg
Copy link
Member Author

Ah, when consumer is disconnecting too, good catch, we don't do that in the normal queues either currently.

@github-actions
Copy link

github-actions bot commented Aug 9, 2023

Main benchmark
'Average publish rate: 351404.7 msgs/s'
'Average consume rate: 351237.3 msgs/s'

PR benchmark
'Average publish rate: 324618.0 msgs/s'
'Average consume rate: 323117.7 msgs/s'

Keep in mind, these numbers are not representative of LavinMQ's peak performance.
It is rather an indication of how the changes of this pull request affects the performance of the main branch.

Previous behavior could unmap segments that other consumers were still
delivering from, causing segfaults.
Digest would otherwise with its small IO.copy buffer use the double
buffering.
FileUtil.rm_rf would otherwise possibly have to iterate over a lot of
files
Memory should never be allocated in a finalize method so can't have the
risk of raising something there
File.write in 1.9.2 allocates a write buffer, which is unessecary
@carlhoerberg carlhoerberg marked this pull request as ready for review September 8, 2023 12:37
@carlhoerberg carlhoerberg merged commit 2e43fbb into main Sep 8, 2023
20 of 23 checks passed
@carlhoerberg carlhoerberg deleted the stream-queue-unmap branch September 8, 2023 12:37
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.

2 participants