
Simulating GitLab Activity
- Paul Thomas
- Gitlab , Testing
- January 8, 2025
Table of Contents
Self-hosted GitLab instances are critical infrastructure for many organizations. While setting up GitLab is straightforward, operating it at scale requires deep understanding of its behavior under real-world conditions. This is where user activity simulation can become invaluable.
Developing Robust Observability
Simulated user activity provides consistent, predictable load patterns that help establish monitoring baselines. By generating merge requests, CI pipeline runs, and repository operations at controlled rates, teams can:
- Validate metrics collection and visualization across GitLab components
- Identify performance bottlenecks before they impact production
- Test alerting thresholds against known activity patterns
- Measure resource utilization across different load profiles
The predictable nature of simulated traffic makes it easier to spot anomalies and verify monitoring system effectiveness.
Disaster Recovery Testing
Regular disaster recovery testing is essential but risky in production environments. With simulated users, teams can safely:
- Test component failover mechanisms
- Validate backup and restoration procedures
- Measure recovery time objectives (RTO) under realistic conditions
- Practice incident response procedures
- Verify data consistency after recovery
The controlled environment allows teams to iterate on recovery procedures without impacting real users.
New User Training
Simulated activity creates a rich, interactive environment for training:
- New team members can observe realistic GitLab workflows
- Training exercises can include responding to common issues
- Documentation can reference concrete examples
- Users can practice administrative tasks safely
- Teams can experiment with GitLab features and integrations
This hands-on experience accelerates learning while eliminating risk to production systems.
Performance Optimization
Understanding performance characteristics requires consistent, reproducible workloads. Simulation enables:
- A/B testing of configuration changes
- Capacity planning for growth
- Database optimization and tuning
- Load balancer configuration validation
- Resource allocation decisions
The ability to generate specific traffic patterns helps teams optimize with confidence.
How to Simulate User Activity
GitLab API
The GitLab API comprehensively supports the user actions that make up the daily activity on a GitLab installation. These include repository creation, cloning, pushing changes as well as creating and dealing with merge requests or issues.
As well as using the native API calls, there are higher-level libraries such as the excellent python-gitlab which makes it easy to script relatively complicated actions and perform them on a scheduled basis.
A Simple Example
A very common repository activity would be a developer submitting a merge-request, and another developer subsequently accepting or closing the MR.
We can do simulate this by running a script with two threads:
- Thread 1 : sleep for a random delay, then select a project, update the README.md and create an MR, repeat
- Thread 2 : sleep for a random delay, select an open MR, either accept or close it, repeat
Some python code implementing this can be found here: https://gitlab.com/toastermagic/gitlab-activity-simulator
Implementation Considerations
When implementing user simulation:
Create realistic workflow patterns that match your organization’s usage Include both regular and burst traffic patterns Simulate across all major GitLab features: git operations, CI/CD, merge requests, etc. Monitor system impact of the simulation itself Maintain separation between simulated and production traffic
Conclusion
User activity simulation transforms GitLab operation from reactive to proactive. It provides a foundation for continuous improvement while reducing risk. For teams running business-critical GitLab instances, it’s an essential tool for maintaining reliability and performance.