Introduction to Gitaly
Gitaly is a Git RPC service for handling all the git calls made by GitLab. It provides fault-tolerant horizontal scaling of Git storage in GitLab, particularly on gitlab.com.Gitaly is already included in your GitLab installation. Most users won’t need to install Gitaly separately.
What is Gitaly?
Gitaly is a layer that brings horizontal scaling and higher availability to massively scaled Git operations through optimizations in:- Disk locality - Moving Git operations close to storage
- Caching - Caching results of intensive operations like
git pack-objects - Coordination - Managing operations between multiple nodes
- Cluster synchronization - Keeping repositories in sync across nodes
- Sharding - Distributing repositories across storage
Key Features
RPC-Based Architecture
Uses gRPC for high-performance remote procedure calls, exposing high-level Git operations instead of low-level lookups
Horizontal Scaling
Scales Git storage horizontally by eliminating NFS bottlenecks and moving Git operations close to disk
High Availability
Built-in HA solution with Praefect for asynchronous replication and automatic failover
Performance Optimization
Centralized monitoring, intelligent caching, and reduced filesystem latency for Git operations
Why Gitaly?
Git’s architectural characteristics make horizontal scaling challenging:- Stateful, ACID transactions - Database-like workload with memory/CPU/disk IO requirements
- Process atomic transactions - One commit coordinated by one Git process
- Storage channel speeds - Assumes low latency, high bandwidth storage access
- Burst resource needs - High burst CPU, memory, and storage utilization based on content size
- Providing one central place to monitor operations
- Implementing performance improvements through caching
- Moving Git operations from the app to the file/git server via RPC
- Enabling distributed storage and read operations
As of GitLab 11.5, almost all application code accesses Git repositories through Gitaly instead of direct disk access. GitLab.com production no longer uses NFS mounts for Git repositories.
Project Goals
Gitaly focuses on two main areas:- Migrate from NFS to RPC - Replace repository access via NFS with gitaly-proto, GitLab’s Git RPC protocol
- Evolve infrastructure - Move from large Gitaly servers managed as “pets” to smaller servers that are “cattle”
Gitaly Clients
Several GitLab components act as Gitaly clients:- gitlab-rails - The main GitLab Rails application
- gitlab-shell - For
git clone,git pushvia SSH - gitlab-workhorse - For
git clonevia HTTPS and serving raw Git data - gitaly-ssh - For internal Git data transfers between Gitaly servers
- gitaly-ruby - For RPCs that interact with multiple repositories
Get Started
Architecture Overview
Learn about Gitaly’s architecture, design decisions, and how it fits into GitLab
Quick Start
Get Gitaly up and running with configuration examples and setup instructions
Configuration Reference
Detailed configuration options for Gitaly and Praefect
High Availability
Set up Praefect for asynchronous replication and failover