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

Use pre-allocated protobufs during backups. #5404

Merged
merged 10 commits into from
May 22, 2020
Merged

Conversation

martinmr
Copy link
Contributor

@martinmr martinmr commented May 8, 2020

Backups convert the values stored in disk into an intermediate format
(for backwards compatibility reasons). This creates a lot of
pb.PostingList and pb.BackupPostingList objects that are discarded
almost immediately. Using preallocated protobufs (one per thread used by
the stream object) should avoid these allocations altogether.

Fixes DGRAPH-1312


This change is Reviewable

Docs Preview: Dgraph Preview

Backups convert the values stored in disk into an intermediate format
(for backwards compatibility reasons). This creates a lot of
pb.PostingList and pb.BackupPostingList objects that are discarded
almost immediatly. Using a sync.Pool to allocate these objects should
reduce the amount of memory that is allocated during a backup.
@martinmr martinmr requested review from manishrjain and a team as code owners May 8, 2020 22:33
@martinmr martinmr changed the title Use a sync pool to store posting lists during backup. Use pre-allocated protobufs during backups. May 12, 2020
Copy link
Contributor

@manishrjain manishrjain left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewed 5 of 5 files at r1.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @martinmr and @vvbalaji-dgraph)


worker/backup_processor.go, line 298 at r1 (raw file):

	pl := pr.plList[threadNum]
	bpl := pr.bplList[threadNum]
	defer func() {

Remove defer here. Do the reset upfront.

Copy link
Contributor Author

@martinmr martinmr left a comment

Choose a reason for hiding this comment

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

Reviewable status: 1 of 5 files reviewed, 1 unresolved discussion (waiting on @manishrjain and @vvbalaji-dgraph)


worker/backup_processor.go, line 298 at r1 (raw file):

Previously, manishrjain (Manish R Jain) wrote…

Remove defer here. Do the reset upfront.

Done.

@martinmr martinmr merged commit e4fdecb into master May 22, 2020
@martinmr martinmr deleted the martinmr/backup-pools branch May 22, 2020 21:45
martinmr added a commit that referenced this pull request May 22, 2020
Backups convert the values stored in disk into an intermediate format
(for backwards compatibility reasons). This creates a lot of
pb.PostingList and pb.BackupPostingList objects that are discarded
almost immediatly. Using preallocated protobufs (one per thread used by
the stream object) should avoid these allocations altogether.

Fixes DGRAPH-1312
dna2github pushed a commit to dna2fork/dgraph that referenced this pull request Jul 18, 2020
Backups convert the values stored in disk into an intermediate format
(for backwards compatibility reasons). This creates a lot of
pb.PostingList and pb.BackupPostingList objects that are discarded
almost immediatly. Using preallocated protobufs (one per thread used by
the stream object) should avoid these allocations altogether.

Fixes DGRAPH-1312
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

2 participants