Unrelative components are disables in our team for vulnerabilities concerns.
Before Gitlab 15, we implemented the availability of Gitlab via shared NFS, despite there could be minor latency errors while accessing the filesystem.
Since Gitlab 16, Gitaly which is the filesystem layer of Git that undertakes Git commands, has officially ended of support of NFS, Luster, GlusterFS, multi-attach EBS and EFS. The only supported block storage is cloud storage, such as Cinder, EBS, or VMDK.
We have 3K active users per month on self hosting Gitlab instances, which undertake CI/CD builds (by Jenkins) and source code management. We consistently monitor the Gitlab instances with grafana to find the performance issues.
According to our statistics, there are some requirements for Gitlab hosting
CPU: Gitlab is not a CPU-bound application, as the peak CPU time is during the merge request only. But you may not use the oversold CPU instances, as the network adapter requires better CPU specs.
Memory: Gitlab requires memories at a range of 8GB and 128GB. Besides the application memory, the operating system may cache the git repository files into memory pages.
Networking: Gitlab requires high I/O speed during the code pull and push
Local storage: Gitlab requires high performance storage during the merge request, the cloud SSD disk is recommended.
In summary, I’d recommend deploying on an instance that has 4U/32G or 8U/64G machine with large local cloud SSD disks.
Besides the virtual machine, we also tested deploying instances on bare metals and found that running on bare metals was not as efficient as we thought, as all resources were not utilized effectively.
Only 100GB of memories (including the OS pages) were used, but 1TB/512GB memories were installed on the machine.
The 25Gb/s fiber network adapter was wasted, as we only have 5Gb/s peak traffics.
To keep the repository hosting with high availability, we apply the segregation of duties(SoD) principal on Gitlab. Features such as CI/CD, GitOps, KAS(Kuberenetes management), or artifacts are disabled in our self-hosting Gitlab. Instead, we opt other well-known alternatives (JFrog, Jenkins, Gerrit) to maintain the simplicity of Gitlab instances.
Here are some Git hosting solutions.
Gitlab Enterprise | Wandisco’s Gerrit | Hot standby Gitlab | |
---|---|---|---|
License | Commercial | Commercial | OSS |
Docs | Gitlab Geo-replica. | Wandisco’s Multisite solution | Here |
Minimum local nodes | 5 | 1 * | 2 |
Support local storages | Y | Y | N (Dedicated storage required) |
High availability | Y | Y(Paxo) | Generally |
Disaster tolerance | Y (with Gitlab Geo) | Y(replicating over WANs) | N |
Comments | Gitlay cluster requires an additional Postgres | Ecosystems changed | Swichover is not automatically. |
You need to pay enterprise licenses to get the premium service.
It works fine on both bare metal and virtualized machines, even with the local storage.
By using gerrit, you have to switch the ecosystem from Gitlab to Gerrit. I believe it’s okay to use gerrit if your team is switching from subversion to Git.
To avoid the computing node disruptions, we believe Gitlab node should never access it’s local storage but access centralized and dedicated storage nodes through fibers, such as a NetApp/OceanStor hardware, or Cinder virtualization platform.
The diagram shows a hot standby architecture, The secondary VM is connecting the primary VM directly with Gitaly client through gRPC, rather than connecting to a disk.
The component sidekiq, a distributed job executor, is disabled in the secondary node, as we found when users want to retrieve some temporary file generated by a background job, the Nginx couldn’t assure the request is routed into the same node.
You are allowed to create one more more Secondary VMs to minimize the downtime risk.
Compared with the single node deployment, when the primary VM is down, despite the unavailability of accessing code, the rails application in the secondary node, which is database backended, is keeping running.
There are three approaches that can set up the high availability of Git hosting. As there is no sliver bullet to eliminate all single point of failures and disasters, the hot standby solution comes with tradeoffs, but it requires no additional license, I hope you find the design useful when deploying Gitlab services.