Skip to content

Files API: Avoid loading the whole blob in memory

Currently, we load the whole blob in memory on calling Files API endpoints. Loading a large file via Gitlab Rails may be severe from performance perspective.

We could avoid loading the whole blob and serve the request via Workhorse, like we plan to do in !67155 (merged), but we have X-Gitlab-Content-Sha256 header that is calculated based on the whole file content. The header has been added within gitlab-foss#47315 (closed) to verify the file content. I wonder if we can recommend using X-Gitlab-Blob-Id instead of X-Gitlab-Content-Sha256 in this case. It's weaker but is also based on content anyway. Other solutions can be calculating it on Workhorse side or prematurely calculate it for a blob.