Gitaly Basics�Stan Hu - May 1, 2017
Goals
Required Reading for Gitaly
Why is git over NFS slow?
strace output
Read .git/packed-refs
Each line contains a SHA -> ref name
Verify each ref exists
Repeat 1619+ times
Total time over network
How we can do better
Do git work locally
Return the results over the network
Unicorn (Rails)
Workhorse (Go)
gitaly (Go binary)�
git <command>
Testing out Gitaly in 9.1
In gitlab-rails console:
irb(main):01:0> proj = Project.find_by_full_path(GROUP/PROJECT)
irb(main):02:0> proj.repository.gitaly_ref_client.branch_names
=> ["bugfix.groovy-triple-quotes", "bugfix.javascript-colons-again", "bugfix.racket-stress-test", "feature.matlab", "feature.scala", "feature.vue", "hotfix.line-number-alignment", "master", "refactor.guessers", "refactor.split-html", "spike.inheritance","spike.token-perf"]
This example is not actually active in 9.1 yet �Will be simplified to repository.branch_names later
How does that work?
gRPC crash course
Finding all branches, gRPC edition
Protocol Buffers -> gRPC Code
.proto file
Rails
Gitaly server
gRPC
Putting it all together
How much is Gitaly being used?
cd lib
git grep -i gitaly
or
git grep -i grpc
Questions?