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

Improve speed and memory performance of syncing #440

Merged
merged 1 commit into from Dec 6, 2019
Merged

Conversation

fao89
Copy link
Member

@fao89 fao89 commented Dec 5, 2019

fao89 added a commit to fao89/pulp_rpm that referenced this pull request Dec 5, 2019
fao89 added a commit to fao89/pulp_rpm that referenced this pull request Dec 5, 2019
fao89 added a commit to fao89/pulp_rpm that referenced this pull request Dec 5, 2019
@@ -71,3 +71,20 @@ def get_view_name_for_model(model_obj, view_action):
if registered_viewset is viewset:
return '-'.join((base_name, view_action))
raise LookupError('view not found')


def batch_qs(qs, batch_size=1000):
Copy link
Member Author

Choose a reason for hiding this comment

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

@dralley dralley changed the title Improve speed and memory performance on syncing Improve speed and memory performance of syncing Dec 6, 2019
@@ -496,6 +500,9 @@ def remove_content(self, content):
if self.complete:
raise ResourceImmutableError(self)

if not content or not content.count():
Copy link
Member

Choose a reason for hiding this comment

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

What motivated adding this?

Copy link
Member Author

Choose a reason for hiding this comment

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

SQLAlchemy enforces to not pass an empty list due performance problems: https://developpaper.com/query-empty-list-problem-analysis-of-sql-alchemy-in/
So I did it to see how it would affect performance on django orm, and I notice a 300 seconds difference from my previous test without this.

Copy link
Member

Choose a reason for hiding this comment

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

Yup that makes sense. Thank you.

Copy link
Member

@bmbouter bmbouter left a comment

Choose a reason for hiding this comment

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

This looks great. Thank you so much! Great job. :octocat: 💯

@bmbouter bmbouter merged commit 62d6dda into pulp:master Dec 6, 2019
fao89 added a commit to fao89/pulp_rpm that referenced this pull request Dec 9, 2019
fao89 added a commit to fao89/pulp_rpm that referenced this pull request Dec 9, 2019
@@ -15,7 +15,7 @@
_logger = logging.getLogger(__name__)

# number of ms between save() calls when _using_context_manager is set
BATCH_INTERVAL = 500
BATCH_INTERVAL = 2000
Copy link
Member Author

@fao89 fao89 Mar 1, 2021

Choose a reason for hiding this comment

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

@gerrod3 @bmbouter @daviddavis maybe we need to change these numbers for pulp_ansible sync ?

@@ -81,7 +81,7 @@ async def run(self):
log.debug(_('%(name)s - next: %(content)s.'), {'name': self, 'content': content})
yield content

async def batches(self, minsize=50):
async def batches(self, minsize=500):
Copy link
Member Author

@fao89 fao89 Mar 1, 2021

Choose a reason for hiding this comment

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

@gerrod3 @bmbouter @daviddavis maybe we need to change these numbers for pulp_ansible sync?

@@ -163,7 +163,7 @@ def __str__(self):
return '[{id}] {name}'.format(id=id(self), name=self.__class__.__name__)


async def create_pipeline(stages, maxsize=100):
async def create_pipeline(stages, maxsize=1000):
Copy link
Member Author

@fao89 fao89 Mar 1, 2021

Choose a reason for hiding this comment

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

@gerrod3 @bmbouter @daviddavis maybe we need to change these numbers for pulp_ansible sync?

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