GitLab Performance Monitoring
- Tier: Free, Premium, Ultimate
- Offering: GitLab Self-Managed
Detect performance bottlenecks before they affect your users with GitLab Performance Monitoring. When slow response times or memory issues occur, pinpoint their exact cause through detailed metrics on SQL queries, Ruby processing, and system resources.
Administrators who implement performance monitoring gain immediate alerts to potential problems before they cascade into instance-wide issues. Track transaction times, query execution performance, and memory usage to maintain optimal GitLab performance for your organization.
For more information on how to configure GitLab Performance Monitoring, see the:
Two types of metrics are collected:
- Transaction specific metrics.
- Sampled metrics.
Transaction Metrics
Transaction metrics are metrics that can be associated with a single transaction. This includes statistics such as the transaction duration, timings of any executed SQL queries, and time spent rendering HAML views. These metrics are collected for every Rack request and Sidekiq job processed.
Sampled Metrics
Sampled metrics are metrics that cannot be associated with a single transaction. Examples include garbage collection statistics and retained Ruby objects. These metrics are collected at a regular interval. This interval is made up of two parts:
- A user defined interval.
- A randomly generated offset added on top of the interval, the same offset can’t be used twice in a row.
The actual interval can be anywhere between a half of the defined interval and a half above the interval. For example, for a user defined interval of 15 seconds the actual interval can be anywhere between 7.5 and 22.5. The interval is re-generated for every sampling run instead of being generated one time and reused for the duration of the process’ lifetime.
User defined intervals can be specified by means of environment variables. The following environment variables are recognized:
RUBY_SAMPLER_INTERVAL_SECONDSDATABASE_SAMPLER_INTERVAL_SECONDSACTION_CABLE_SAMPLER_INTERVAL_SECONDSPUMA_SAMPLER_INTERVAL_SECONDSTHREADS_SAMPLER_INTERVAL_SECONDSGLOBAL_SEARCH_SAMPLER_INTERVAL_SECONDSPG_ASH_SAMPLER_INTERVAL_SECONDS
Active session history
- Tier: Free, Premium, Ultimate
- Offering: GitLab Self-Managed
- Status: Experiment
Active session history samples pg_stat_activity on the main database, so you can see what the
database was doing at a point in the past.
GitLab vendors pg_ash to collect and store the samples.
This feature is an experiment and is not ready for production use. Test it outside of production first.
pg_ash is not installed by default, and sampling is off by default.
To install pg_ash:
sudo gitlab-rake gitlab:db:pg_ash:installTo check an install:
sudo gitlab-rake gitlab:db:pg_ash:statusTo remove pg_ash and every sample it holds:
sudo gitlab-rake gitlab:db:pg_ash:uninstallTo install pg_ash:
kubectl exec -it <toolbox-pod-name> -- gitlab-rake gitlab:db:pg_ash:installTo check an install:
kubectl exec -it <toolbox-pod-name> -- gitlab-rake gitlab:db:pg_ash:statusTo remove pg_ash and every sample it holds:
kubectl exec -it <toolbox-pod-name> -- gitlab-rake gitlab:db:pg_ash:uninstallTo install pg_ash:
sudo docker exec -t <container-name> gitlab-rake gitlab:db:pg_ash:installTo check an install:
sudo docker exec -t <container-name> gitlab-rake gitlab:db:pg_ash:statusTo remove pg_ash and every sample it holds:
sudo docker exec -t <container-name> gitlab-rake gitlab:db:pg_ash:uninstallTo install pg_ash:
sudo -u git -H bundle exec rake gitlab:db:pg_ash:install RAILS_ENV=productionTo check an install:
sudo -u git -H bundle exec rake gitlab:db:pg_ash:status RAILS_ENV=productionTo remove pg_ash and every sample it holds:
sudo -u git -H bundle exec rake gitlab:db:pg_ash:uninstall RAILS_ENV=productionTo turn on sampling:
- Sign in as a user with administrator access.
- In the upper-right corner, select Admin.
- In the left sidebar, select Settings > Metrics and profiling.
- Expand the Active session history section.
- Select the Turn on session sampling checkbox.
- Optional. Change Sample interval (seconds). The default is one second.
- Select Save changes.
A background thread in the Sidekiq process takes the samples. Only one process samples at a time, so the interval you set is the interval for the whole instance. Sampling needs the GitLab Prometheus metrics endpoint, which is on by default. Sampling stops when Sidekiq stops, so a restart or a deployment can lose samples.
A change to either setting applies without a restart, but not at once. Each Sidekiq process reads the new value in up to 90 seconds.
PG_ASH_SAMPLER_INTERVAL_SECONDS sets how often a Sidekiq process checks whether it should take
over as the sampling process.
It does not set the sample interval.
GitLab does not summarize or delete old samples. Sample data grows until you uninstall pg_ash.
Support for these operations is proposed in
issue 608100.