##// END OF EJS Templates
fix: escaper, use h.escape instead of html_escape since it's faster and correct
fix: escaper, use h.escape instead of html_escape since it's faster and correct

File last commit:

r5344:206a16d7 stable
r5465:0684a98a default
Show More
tuning-gunicorn.rst
118 lines | 3.9 KiB | text/x-rst | RstLexer

Configure Gunicorn Workers

|RCE| comes with Gunicorn which is a Python WSGI HTTP Server for UNIX.

To improve |RCE| performance you can increase the number of Gunicorn workers. This allows to handle more connections concurrently, and provide better responsiveness and performance.

By default during installation |RCC| tries to detect how many CPUs are available in the system, and set the number workers based on that information. However sometimes it's better to manually set the number of workers.

To do this, use the following steps:

  1. Open the :file:`home/{user}/.rccontrol/{instance-id}/rhodecode.ini` file.
  2. In the [server:main] section, change the number of Gunicorn workers using the following default formula (2*Cores) + 1. We however not recommend using more than 8-12 workers per server. It's better to start using the :ref:`scale-horizontal-cluster` in case that performance with 8-12 workers is not enough.
; Sets the number of process workers. More workers means more concurrent connections
; RhodeCode can handle at the same time. Each additional worker also it increases
; memory usage as each has it's own set of caches.
; Recommended value is (2 * NUMBER_OF_CPUS + 1), eg 2CPU = 5 workers, but no more
; than 8-10 unless for really big deployments .e.g 700-1000 users.
; `instance_id = *` must be set in the [app:main] section below (which is the default)
; when using more than 1 worker.
workers = 6

; Type of worker class, one of `sync`, `gevent`
; Use `gevent` for rhodecode
worker_class = gevent

; The maximum number of simultaneous clients per worker. Valid only for gevent
worker_connections = 10
  1. In the [app:main] section, set the instance_id property to *.
# In the [app:main] section
[app:main]
# You must set `instance_id = *`
instance_id = *
  1. Change the VCSServer workers too. Open the :file:`home/{user}/.rccontrol/{instance-id}/vcsserver.ini` file.
  2. In the [server:main] section, increase the number of Gunicorn workers using the following formula (2*Cores) + 1.
; Sets the number of process workers. More workers means more concurrent connections
; RhodeCode can handle at the same time. Each additional worker also it increases
; memory usage as each has it's own set of caches.
; Recommended value is (2 * NUMBER_OF_CPUS + 1), eg 2CPU = 5 workers, but no more
; than 8-10 unless for really big deployments .e.g 700-1000 users.
; `instance_id = *` must be set in the [app:main] section below (which is the default)
; when using more than 1 worker.
workers = 8

; Type of worker class, one of `sync`, `gevent`
; Use `sync` for vcsserver
worker_class = sync
  1. Save your changes.
  2. Restart your |RCE| instances, using the following command:
$ rccontrol restart '*'

Gunicorn Gevent Backend

Gevent is an asynchronous worker type for Gunicorn. It allows accepting multiple connections on a single Gunicorn worker. This means you can handle 100s of concurrent clones, or API calls using just few workers. A setting called worker_connections defines on how many connections each worker can handle using Gevent.

To enable Gevent on |RCE| do the following:

  1. Open the :file:`home/{user}/.rccontrol/{instance-id}/rhodecode.ini` file.
  2. In the [server:main] section, change worker_class for Gunicorn.
; Type of worker class, one of `sync`, `gevent`
; Use `gevent` for rhodecode
worker_class = gevent

; The maximum number of simultaneous clients per worker. Valid only for gevent
worker_connections = 30

Note

Gevent is currently only supported for Enterprise/Community instances. VCSServer doesn't support gevent.