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
Job list view makes multiple ensure_git_repository
(slow) calls on the same repo
#4142
Comments
Thanks for the report! I think this is fixed by some of the more structural changes to Git and Jobs in 2.0, but we can definitely look at whether this can be addressed by a more targeted fix in the LTM release. |
Would it be acceptable if instead we opted for the cache key to be "hostname" + "repo id"? This would make implementation significantly easier and hostname to file system should be at worst a many-to-one, so this should be an immediate performance improvement. |
#4844 doesn't do exactly this, but it rather ends calls to |
Environment
Steps to Reproduce
Expected Behavior
At most one
ensure_git_repository
call (per repo) is madeObserved Behavior
One
ensure_git_repository
per job is madeAdditional informations
A little bit like #1515, when a repo contains many (~10-20) jobs, and the git directory is hosted on a slow filesystem (like glusterfs ..), it makes loading the job list page very slow (about 5 secs). Also there's no need to refresh the same repo multiple time in the same request. The code calling this refresh is
runnable()
(for the buttons):One way (maybe not the best?) to fix this might be to store in the redis cache a key with the
current request id + repo id
(with a low expiry time, like 300s, as it's per request) to check if the key exists and in this case prevent the refresh, but this requires to be able to access the request, which only seems feasible through a middleware (https://stackoverflow.com/questions/7267977/is-the-global-request-variable-in-python-django-available)? But in this case maybe the middleware could handle everything (patching the function)? Or instead of the cache, use a variable in that middleware?The text was updated successfully, but these errors were encountered: