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

Do not open dispatchers in follower role #9367

Merged
merged 9 commits into from
May 13, 2022
Merged

Conversation

deepthidevaki
Copy link
Contributor

@deepthidevaki deepthidevaki commented May 12, 2022

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:

  • The changes are backwards compatibility with previous versions
  • If it fixes a bug then PRs are created to backport the fix to the last two minor versions. You can trigger a backport by assigning labels (e.g. backport stable/1.3) to the PR, in case that fails you need to create backports manually.

Testing:

  • There are unit/integration tests that verify all acceptance criterias of the issue
  • New tests are written to ensure backwards compatibility with further versions
  • The behavior is tested manually
  • The change has been verified by a QA run
  • The impact of the changes is verified by a benchmark

Documentation:

  • The documentation is updated (e.g. BPMN reference, configuration, examples, get-started guides, etc.)
  • New content is added to the release announcement
  • If the PR changes how BPMN processes are validated (e.g. support new BPMN element) then the Camunda modeling team should be informed to adjust the BPMN linting.

Please refer to our review guidelines.

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.
@deepthidevaki deepthidevaki changed the title Dd 8509 follower sp Do not open dispatchers in follower role May 12, 2022
@deepthidevaki
Copy link
Contributor Author

deepthidevaki commented May 12, 2022

Result of the benchmark : #8509 (comment)

I have also started a new benchmark with the version on this pr.

@Zelldon
Copy link
Member

Zelldon commented May 13, 2022

@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.
@deepthidevaki
Copy link
Contributor Author

I think it makes sense to run this test on the long running benchmark, here we see more the OOM.

Yes. I will start a long running benchmark after the PR is merged.

Copy link
Member

@Zelldon Zelldon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @deepthidevaki 🚀👍

@deepthidevaki
Copy link
Contributor Author

bors merge

@zeebe-bors-camunda
Copy link
Contributor

@zeebe-bors-camunda zeebe-bors-camunda bot merged commit 3618c4a into main May 13, 2022
@zeebe-bors-camunda zeebe-bors-camunda bot deleted the dd-8509-follower-sp branch May 13, 2022 13:03
@lenaschoenburg
Copy link
Member

Maybe worth to backport it to at least 8.0?

@deepthidevaki
Copy link
Contributor Author

/backport

@github-actions
Copy link
Contributor

Backport failed for stable/1.3, because it was unable to cherry-pick the commit(s).

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

@github-actions
Copy link
Contributor

Backport failed for stable/8.0, because it was unable to create a new branch.

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

zeebe-bors-camunda bot added a commit that referenced this pull request May 13, 2022
9376: [Backport  stable/8.0] Do not open dispatcher on follower role r=deepthidevaki a=deepthidevaki

## Description

Backport of #9367 

related #8509 


Co-authored-by: Deepthi Devaki Akkoorath <deepthidevaki@gmail.com>
zeebe-bors-camunda bot added a commit that referenced this pull request May 16, 2022
9377: [Backport stable/1.3] Do not open dispatcher on follower role r=deepthidevaki a=deepthidevaki

## Description

Backport of #9367

related #8509

Co-authored-by: Deepthi Devaki Akkoorath <deepthidevaki@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants