Skip to content

Implement FindAllTags as raw byte stream

We sometimes see problems on production Gitaly servers when they have to serve a lot of FindAllTags traffic. gitlab-org/gitlab#340659 (closed)

This issue explores implementing FindAllTags in a radically different way:

  1. Gitaly serves a byte stream of unparsed tags
  2. Rails consumes and parses the byte stream

Proof of concept code


Experiment Latency (100 calls) Calls / 30s Gitaly server CPU (30s steady state) Samples/call
Baseline (status quo) #1314 (comment 689323443) 59s 50.8 4527 samples 89
Byte stream iteration 3 #1314 (comment 691242281) 9s 333 3289 samples 10

Advantages

  1. We can go 6x faster than the status quo and use 9x less Gitaly server CPU per call
  2. Approach can also be applied to other RPC's that return branches, commits etc.

Disadvantages

  1. Requires up-front development work to build correct and performant parsers in gitlab-rails for commits and tags
  2. Not sure how hard parsing commit trailers will be (current implementation shells out to git on gitaly server; we'd have to parse the trailers directly from raw git object). But I'm not sure FindAllTags returns trailers in the first place?
Edited by Jacob Vosmaer