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

[BREAKING] Fix(OOM): Don't unmarshal pb.Proposals until we need them #7059

Merged
merged 17 commits into from Dec 10, 2020

Conversation

manishrjain
Copy link
Contributor

@manishrjain manishrjain commented Dec 4, 2020

In worker/draft.go, in Raft.Ready() when we get committed entries, we were unmarshalling them to pb.Proposals upfront. Instead, push them to applyCh as it is, and only when we need them, we unmarshal them. This should fix an OOM issue we see with pb.Proposals unmarshal taking up a lot of memory.

We achieve this by switching proposal.Key which is a string to a uint64 key, which can be put directly in the raft entry.Data in the first 8 bytes. The rest are used to marshal proposal.

Additional changes:

  • Bump up max pending proposal size to 256 MB to increase proposal throughput.

This change is Reviewable

@netlify
Copy link

netlify bot commented Dec 4, 2020

✔️ Deploy preview for dgraph-docs ready!

🔨 Explore the source changes: c8f4c8b

🔍 Inspect the deploy logs: https://app.netlify.com/sites/dgraph-docs/deploys/5fd285f9db83b40007651c75

😎 Browse the preview: https://deploy-preview-7059--dgraph-docs.netlify.app

@manishrjain manishrjain changed the title Don't unmarshal pb.Proposals until we need them Fix(OOM): Don't unmarshal pb.Proposals until we need them Dec 4, 2020
@manishrjain manishrjain marked this pull request as ready for review December 4, 2020 18:14
@manishrjain manishrjain changed the title Fix(OOM): Don't unmarshal pb.Proposals until we need them [BREAKING] Fix(OOM): Don't unmarshal pb.Proposals until we need them Dec 10, 2020
@manishrjain manishrjain merged commit 2e5499f into master Dec 10, 2020
@manishrjain manishrjain deleted the mrjn/proposals-to-Buffer branch December 10, 2020 21:10
NamanJain8 pushed a commit that referenced this pull request Dec 16, 2020
This PR updates the raftmigrate tool. We recently updated raft proposal format for alpha and zero, see #7059 .
The tool now can migrate raftwal from old proposal format to new proposal format wherein we are encoding the proposal.Key within the entry.Data.
This change will help to migrate raftwal from [RC-2,RC-3] to RC-4 onwards.
NamanJain8 pushed a commit that referenced this pull request Dec 17, 2020
This PR updates the raftmigrate tool. We recently updated raft proposal format for alpha and zero, see #7059 .
The tool now can migrate raftwal from old proposal format to new proposal format wherein we are encoding the proposal.Key within the entry.Data.
This change will help to migrate raftwal from [RC-2,RC-3] to RC-4 onwards.

(cherry picked from commit ab0f3ea)
NamanJain8 added a commit that referenced this pull request Dec 17, 2020
chore: Update Raft migrate tool to handle new proposal format (#7123)

This PR updates the raftmigrate tool. We recently updated raft proposal format for alpha and zero, see #7059 .
The tool now can migrate raftwal from old proposal format to new proposal format wherein we are encoding the proposal.Key within the entry.Data.
This change will help to migrate raftwal from [RC-2,RC-3] to RC-4 onwards.

(cherry picked from commit ab0f3ea)

Co-authored-by: Rahul Gurnani <rahulgurnani09@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants