Slow loading times / bad overall performance on a fresh local docker install


I am experiencing overall slow performance on my gitlab installation, even though it is locally running.

Are there any performance tweaks to make? This should not be an hardware issue (6 cores, 12 threads, 16GB DDR4 RAM, running on an SATA SSD).

Slow performance means:

  • An initial page load (for example of a repository) takes multiple seconds, this can be seen in the network tab of the browser (the initial request takes most of the time, at least 2 seconds; the DOM is then ready in more than 3 seconds)
  • It could be the API response time which is slow, since curl -I http://localhost/it/testproject returns X-Runtime: 2.230676 for example
  • The slow response time disappears when the exact same repository has been viewed a few times in web UI. Then the intial request takes only 263ms. This sounds like caching.
  • Most affected are the repository pages in web ui (for example http://localhost/it/textproject).

What I did already:

  • Increased the puma workers to 5 (cpu cores - 1), from Requirements | GitLab
  • Set the puma threads to 4 (min and max), see Requirements | GitLab
  • Increased the maximum ram a puma worker can get until it gets restarted to 1250 megabytes
  • Packed PostgreSQL and Redis into an extra container, outside of Gitlab

I am using the following configuration for a self hosted gitlab installation via docker-compose.


version: '3'

    container_name: production-gitlab-redis
    image: redis:5.0.9
      - --loglevel warning
      - ./gitlab/redis:/var/lib/redis
      - '6379'
    container_name: production-gitlab-db
    image: postgres:13
      - ./gitlab/postgresql:/var/lib/postgresql/data
      - '5432'
      POSTGRES_DB: gitlabhq_production
      POSTGRES_USER: gitlab
      POSTGRES_PASSWORD: password
    container_name: production-gitlab-website
    image: gitlab/gitlab-ce:latest
      - ./gitlab/config:/etc/gitlab
      - ./gitlab/logs:/var/log/gitlab
      - ./gitlab/data:/var/opt/gitlab
      - '26:22'
      - '80:80'
      - '443:443'
        #external postgresql
        postgresql['enable'] = false
        gitlab_rails['db_adapter'] = 'postgresql'
        gitlab_rails['db_encoding'] = 'unicode'
        gitlab_rails['db_host'] = 'production-gitlab-db'
        gitlab_rails['db_password'] = 'password'
        #external redis
        redis['enable'] = false
        gitlab_rails['redis_host'] = 'production-gitlab-redis'
        gitlab_rails['redis_port'] = 6379
        #gitlab settings
        external_url 'http://localhost'
        gitlab_rails['gitlab_shell_ssh_port'] = 26
        gitlab_rails['gitlab_default_can_create_group'] = false
        gitlab_rails['gitlab_username_changing_enabled'] = false
        # Performance
        puma['worker_processes'] = 5
        puma['min_threads'] = 4
        puma['max_threads'] = 4
        puma['per_worker_max_memory_mb'] = 1250

Are there any performance tweaks, I could make? is much faster and snappier, so this might be a configuration issue on my side?

This should not be an hardware issue (6 cores, 12 threads, 16GB DDR4 RAM, running on an SATA SSD).

Does this describe your host hardware, such as a laptop? If it is a macOS MBP, I’ve faced a similar issue which was due to the way Docker runs on that platform (through a virtual machine). Allocating some more resources manually to the virtual machine it ran helped eke out more performance. By default, it is very constrained in what is allocated to it.

The controls were in > Preferences > Resources.

Docker for Mac isn’t kind to the MBP CPU fan though.

Hi, thank you for your reply!

We also have these problems on a Linux (Debian 10) host, without virtualization at all. I can see if there is something we can set on the docker side.

Also, when I test the docker image locally on a Windows machine, I have similar (poor) performance. Here I can also have a look in the Docker settings.