Scaling down: How we shrank image transfers by 93%

This post details the implementation of an on-the-fly image scaling solution within GitLab Workhorse. The solution addresses performance and cost issues by resizing images (primarily avatars) to their requested dimensions before delivery to the client. The decision was made to scale dynamically rather than statically due to maintenance overhead and flexibility concerns with existing uploaders. Workhorse was chosen as the integration point over a dedicated proxy like imgproxy due to its existing role as a reverse proxy and alignment with the MVC principle. The implementation involved integrating image scaling logic into Workhorse, leveraging its existing request authentication and business logic validation patterns, and considering approaches like shelling out to an executable or running a sidecar process for the scaling workload.