pulp / pulp/pulpcore

requesting lots of packages with a subset of fields still causes changelogs, filelists, requires, etc.. to be loaded, resulting in slow requests

Open
#2,138 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Issue Performance satellite
Dominant language
Python
Stars
598
Forks
168
Avg merge
1d 4h
Merged PRs (30d)
86

Description

Author: @jlsherrill (jsherril@redhat.com)

Redmine Issue: 9655, https://pulp.plan.io/issues/9655


When we make a request like this:

/pulp/api/v3/content/rpm/packages/?fields=pulp_href%2Cname%2Cversion%2Crelease%2Carch%2Cepoch%2Csummary%2Cis_modular%2Crpm_sourcerpm%2Clocation_href%2CpkgId&limit=1&offset=1000&repository_version=%2Fpulp%2Fapi%2Fv3%2Frepositories%2Frpm%2Frpm%2Fc6b93206-22bb-4c58-ba07-828c32326330%2Fversions%2F1%2F

where some subset of fields is requested, we're still seeing all of the fields being loaded from the database. The result is that the query takes much much longer than it should

Testing on the rhel7 repo, it took about ~100 seconds on my machine to fetch all 32K packages specifying the fields above. If I comment out the filelists, changelogs, provides/requires from the model and serializers, that drops down to ~33 seconds. This is a huge improvement.

Reading this: https://stackoverflow.com/questions/53319787/how-can-i-select-specific-fields-in-django-rest-framework

it looks like its may be possible to exclude certain fields from the query itself fairly easily.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the packages endpoint request with the listed fields and inspect the Django REST Framework serializer and database-query path. Done means the query loads only requested fields while preserving the response, and the request completes substantially faster than the reported baseline.

Written by the indexing model from the issue text.

Assessment

Tech stack
django, python
Domain
api, backend, databases, performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.