Skip to content

POC for caching most lightweight data from blobs when viewing diffs

Oswaldo Ferreira requested to merge osw-cache-viewer-for-diffs-blobs-poc into master

This is a temporary POC MR.

This MR tests the hypothesis of caching most Blob service calls when viewing merge request diffs. Happens that these calls are not cheap and it's pretty much cacheable, since we don't really need the blob content (unless we're highlighting).

Update: This currently works and we just fetch blobs (list_blobs_by_sha_path in Gitaly) in the first request for /diffs.

TODO:

  • Batch load uncached blobs (first request)
  • Understand and fix when we request blobs for "too large" ones ("This source diff could not be displayed because it is too large"). We don't need the whole data, so doesn't make sense to request these 🤔
    • We can safely use the cached blob here without requesting the whole data
  • Refresh cache instead cleaning when reloading diffs
  • Double-check what'll happen to image blobs (we don't cache highlight, so what?)
  • Create a CachedBlob (that receives the cached hash) which delegates to a Hashie::Mash, other methods will blow-up as undefined
  • Add tests 🤖
  • Add statistics
Edited by Oswaldo Ferreira

Merge request reports