Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[#4725] quickfix: cache entire project directory request #4726

Closed

Conversation

MichaelAkvo
Copy link
Contributor

The projects don't change often, so we should be able to cache them for a while.
Additionally, every hour we will regenerate their cached values (take ~7m right now).

So the quick fix is two-fold:

  • cache the entire result and keep for an hour
  • regenerate per project cache every hour

Once the page cache expires, queries should take ~10-20 seconds, but only once until the next hour.

Related to #4725: /rest/v1/project_directory performance

@MichaelAkvo MichaelAkvo force-pushed the feature/4725-/rest/v1/project_directory-performance branch from 82e63ce to ef6b81e Compare December 9, 2021 08:54
@MichaelAkvo
Copy link
Contributor Author

It takes ~7m to cache all projects. It then takes ~10-20 seconds for the first request and < 1 second for cached requests.

About half the time is spent rendering the response and on a slow network more time is spent transferring the response.

@MichaelAkvo MichaelAkvo marked this pull request as ready for review December 9, 2021 09:04
@MichaelAkvo MichaelAkvo requested a review from zuhdil December 9, 2021 09:04
The projects don't change often, so we should be able to cache them for a while.
Additionally, every hour we will regenerate their cached values (take ~7m right now).

So the quick fix is two-fold:

 - cache the entire result and keep for an hour
 - regenerate per project cache every hour

Once the page cache expires, queries should take ~10-20 seconds, but only once until the next hour.

#4725: /rest/v1/project_directory performance
@MichaelAkvo MichaelAkvo force-pushed the feature/4725-/rest/v1/project_directory-performance branch from ef6b81e to 6a315de Compare December 9, 2021 09:05
For some reason it takes a whole lot of time to reverse an URL.
Even the example for `cached_property` uses `absolute_url` as an example.

#4725: /rest/v1/project_directory performance
@MichaelAkvo MichaelAkvo changed the title [#4725] quickfix: cache entire project directory request Draft: [#4725] quickfix: cache entire project directory request Dec 9, 2021
@MichaelAkvo MichaelAkvo marked this pull request as draft December 9, 2021 11:31
@MichaelAkvo MichaelAkvo changed the title Draft: [#4725] quickfix: cache entire project directory request [#4725] quickfix: cache entire project directory request Dec 9, 2021
@MichaelAkvo MichaelAkvo force-pushed the feature/4725-/rest/v1/project_directory-performance branch from 132cc92 to 7221ff4 Compare December 9, 2021 16:01
Instead of relying on django to make deferred queries, we make all queries ourselves,
 build the cache, and use it.
It's per project ID for faster access.

Additionally, `url` is not required anymore as the UI builds the url to the project now

#4725: /rest/v1/project_directory performance
@MichaelAkvo MichaelAkvo force-pushed the feature/4725-/rest/v1/project_directory-performance branch from 7221ff4 to 9b0f6a3 Compare December 9, 2021 16:33
@MichaelAkvo MichaelAkvo deleted the feature/4725-/rest/v1/project_directory-performance branch March 8, 2022 15:06
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

1 participant