Skip to content

Projects::EnvironmentsController#folders is slow

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

https://gitlab.com/gitlab-org/gitlab-runner/-/environments/folders/development.json appears to be taking several seconds to load:

https://log.gprd.gitlab.net/app/r/s/a8e30

image

When you visit https://gitlab.com/gitlab-org/gitlab-runner/-/environments/folders/development, the frontend constantly polls the endpoint https://gitlab.com/gitlab-org/gitlab-runner/-/environments/folders/development.json.

The flamegraph shows that a lot of time spent loading DB records:

flamegraph.html

profile-1749271320-20250607-2377498-1o35cb.dump

user = User.find_by_username('stanhu')
url = 'gitlab-org/gitlab-runner/-/environments/folders/development.json'
output = Gitlab::Profiler.profile(url, user: user)

Note that the logs for Rails shows that the status code is 200, but Workhorse returns 304. This is because Rack is comparing the If-None-Match with ETag (https://github.com/rack/rack/blob/main/lib/rack/conditional_get.rb). Since they match Rack changes the code to 304.

Edited by 🤖 GitLab Bot 🤖