-
Notifications
You must be signed in to change notification settings - Fork 556
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
Do not open dispatchers in follower role #9367
Conversation
In follower role, StreamProcessor is running only in replay mode. When the writer is created, dispatcher is also opened which allocates direct buffer. This is unnecessary as the writer is never used. The allocated buffer consumes memory and can create memory pressure on the system. To fix this, we create the writer only after the replay is completed.
Result of the benchmark : #8509 (comment) I have also started a new benchmark with the version on this pr. |
@deepthidevaki I think it makes sense to run this test on the long running benchmark, here we see more the OOM. |
This is needed for testing where we want to mock the writer.
After the fix where the creation of the writer is moved after the replay is completed, this test failed because the mock writer created by the test is overwritten by the StreamProcessor. To prevent this, we added a new streamWriter factor that can be used by the test to inject mock writers.
Yes. I will start a long running benchmark after the PR is merged. |
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.
Thanks @deepthidevaki 🚀👍
engine/src/main/java/io/camunda/zeebe/engine/processing/streamprocessor/StreamProcessor.java
Show resolved
Hide resolved
engine/src/main/java/io/camunda/zeebe/engine/processing/streamprocessor/StreamProcessor.java
Outdated
Show resolved
Hide resolved
bors merge |
Maybe worth to backport it to at least 8.0? |
/backport |
Backport failed for Please cherry-pick the changes locally. git fetch origin stable/1.3
git worktree add -d .worktree/backport-9367-to-stable/1.3 origin/stable/1.3
cd .worktree/backport-9367-to-stable/1.3
git checkout -b backport-9367-to-stable/1.3
ancref=$(git merge-base fc991eb19245bcae8d5a883d74c070035ee953c2 4b93b005f66e36d0ae901c8226d1446127e90bef)
git cherry-pick -x $ancref..4b93b005f66e36d0ae901c8226d1446127e90bef |
Backport failed for Please cherry-pick the changes locally. git fetch origin stable/8.0
git worktree add -d .worktree/backport-9367-to-stable/8.0 origin/stable/8.0
cd .worktree/backport-9367-to-stable/8.0
git checkout -b backport-9367-to-stable/8.0
ancref=$(git merge-base fc991eb19245bcae8d5a883d74c070035ee953c2 4b93b005f66e36d0ae901c8226d1446127e90bef)
git cherry-pick -x $ancref..4b93b005f66e36d0ae901c8226d1446127e90bef |
Description
In follower role, StreamProcessor is running only in replay mode. When the writer is created, dispatcher is also opened which allocates direct buffer. This is unnecessary as the writer is never used. The allocated buffer consumes memory and can create memory pressure on the system. To fix this, we create the writer only after the replay is completed.
Related issues
related #8509
Definition of Done
Not all items need to be done depending on the issue and the pull request.
Code changes:
backport stable/1.3
) to the PR, in case that fails you need to create backports manually.Testing:
Documentation:
Please refer to our review guidelines.