doc/development/workhorse/gitlab_features.md
Workhorse itself is not a feature, but there are several features in GitLab that would not work efficiently without Workhorse.
To put the efficiency benefit in context, consider that in 2020Q3 on GitLab.com we see Rails application threads using on average about 200 MB of RSS vs about 200 KB for Workhorse goroutines.
Examples of features that rely on Workhorse:
git clone and git push over HTTPGit clone, pull and push are slow because they transfer large amounts of data and because each is CPU intensive on the GitLab side. Without Workhorse, HTTP access to Git repositories would compete with regular web access to the application, requiring us to run way more Rails application servers.
GitLab CI runners fetch new CI jobs by polling the GitLab server. Workhorse acts as a kind of "waiting room" where CI runners can sit and wait for new CI jobs. Because of Go's efficiency we can fit a lot of runners in the waiting room at little cost. Without this waiting room mechanism we would have to add a lot more Rails server capacity. See the long polling documentation for more details.
File uploads and downloads may be slow either because the file is large or because the user's connection is slow. Workhorse can handle the slow part for Rails. This improves the efficiency of features such as CI artifacts, package repositories, LFS objects, etc.
Features such as the web terminal require a long lived connection between the user's web browser and a container inside GitLab that is not directly accessible from the internet. Dedicating a Rails application thread to proxying such a connection would cost much more memory than it costs to have Workhorse look after it.
For security, some parts of the Web IDE must run in a separate origin. To support this approach, the Web IDE relies on Workhorse to appropriately route and decorate certain requests to and from Web IDE assets. Because the Web IDE assets are static frontend assets, it's unnecessary overhead to rely on Rails for this effort.
GitLab AI-assisted features, including GitLab Duo Chat and the GitLab Duo Agent Platform, rely on Workhorse to proxy requests to the GitLab Duo Workflow Service. Workhorse acts as a bridge between the GitLab Rails application and the GitLab Duo Workflow Service, enabling:
For detailed architecture information, see AI-assisted features architecture.
send_file in Rails then GitLab Workhorse opens the file on
disk and send its contents as the response body to the client.git clone.For more information see 'A brief history of GitLab Workhorse'.