Skip to content

Load times are slow for first API request to a unicorn worker

One thing I've observed recently is that the first time you hit a unicorn API worker, things take a few seconds to respond. For example, hitting https://gitlab.com/api/v4/projects/13083/merge_requests?private_token=REDACTED&per_page=100&view=simple takes 5-6 the first time, but if you hit the same API worker again, the time goes to < 1 s.

In gitlab-profiler, we specifically load the first API request once before profiling because the time appears to be dominated by mounting Grape endpoints, loading internationalization files, etc.

Do we need to pre-warm all our API nodes this way?

Edited by Stan Hu