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

WIP - Improve memory performance on syncing #1547

Closed
wants to merge 1 commit into from
Closed

Conversation

fao89
Copy link
Member

@fao89 fao89 commented Dec 3, 2019

ModulemdPackages = Modulemd.packages.through
PackageGroup_packages = PackageGroup.related_packages.through
PackageCategory_groups = PackageCategory.packagegroups.through
PackageEnvironment_groups = PackageEnvironment.packagegroups.through
PackageEnvironment_optionalgroups = PackageEnvironment.optionalgroups.through

update_collection_to_save = MaxSizeBulk(UpdateCollection, 100)
Copy link
Contributor

Choose a reason for hiding this comment

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

bulk_create() has a batch size argument, is there a reason we cannot use that? https://docs.djangoproject.com/en/dev/ref/models/querysets/#bulk-create

Copy link
Member Author

Choose a reason for hiding this comment

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

Yesterday @dkliban said he was suspicious that memory was crashing before hitting the saving point, so I built this object to bulk create as soon it reaches the max_length, so it does not need to wait till the end of the for loop.

Comment on lines -768 to -769
update_collection.save()
update_record.collections.add(update_collection)
Copy link
Member Author

Choose a reason for hiding this comment

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

As @dkliban pointed, these lines were consuming some considerable amount of memory, so I changed to bulk creation.
good improvement in memory consumption

@fao89
Copy link
Member Author

fao89 commented Dec 5, 2019

Closing in favor of: #1550

@fao89 fao89 closed this Dec 5, 2019
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.

None yet

2 participants