##// END OF EJS Templates
docs: updated performance/tunning docs according to latest code changes
dan -
r4172:0f4eef6e default
parent child Browse files
Show More
@@ -0,0 +1,26 b''
1 .. _adjust-rhodecode-mem:
2
3 RhodeCode Memory Usage
4 ----------------------
5
6 Starting from Version 4.18.X RhodeCode has a builtin memory monitor for gunicorn workers.
7 Enabling this can limit the maximum amount of memory system can use. Each worker
8 for RhodeCode is monitored independently.
9 To enable Memory management make sure to have following settings inside `[app:main] section` of
10 :file:`home/{user}/.rccontrol/{instance-id}/rhodecode.ini` file.
11
12
13
14 ; Maximum memory usage that each worker can use before it will receive a
15 ; graceful restart signal 0 = memory monitoring is disabled
16 ; Examples: 268435456 (256MB), 536870912 (512MB)
17 ; 1073741824 (1GB), 2147483648 (2GB), 4294967296 (4GB)
18 memory_max_usage = 1073741824
19
20 ; How often in seconds to check for memory usage for each gunicorn worker
21 memory_usage_check_interval = 60
22
23 ; Threshold value for which we don't recycle worker if GarbageCollection
24 ; frees up enough resources. Before each restart we try to run GC on worker
25 ; in case we get enough free memory after that, restart will not happen.
26 memory_usage_recovery_threshold = 0.8
@@ -1,21 +1,22 b''
1 .. _rhodecode-tuning-ref:
1 .. _rhodecode-tuning-ref:
2
2
3 Tuning |RCE|
3 Tuning |RCE|
4 ============
4 ============
5
5
6 To customize your |RCE| |version| installation for maximum performance you
6 To customize your |RCE| |version| installation for maximum performance you
7 may find some of the following methods useful.
7 may find some of the following methods useful.
8
8
9 .. toctree::
9 .. toctree::
10
10
11 tuning/tuning-gunicorn
11 tuning/tuning-gunicorn
12 tuning/tuning-vcs-memory-cache
12 tuning/tuning-vcs-server-memory-usage
13 tuning/tuning-rhodecode-memory-usage
13 tuning/tuning-user-sessions-performance
14 tuning/tuning-user-sessions-performance
14 tuning/tuning-increase-db-performance
15 tuning/tuning-increase-db-performance
15 tuning/tuning-scale-horizontally-cluster
16 tuning/tuning-scale-horizontally-cluster
16 tuning/tuning-mount-cache-memory
17 tuning/tuning-mount-cache-memory
17 tuning/tuning-change-encoding
18 tuning/tuning-change-encoding
18 tuning/tuning-change-large-file-dir
19 tuning/tuning-change-large-file-dir
19 tuning/tuning-change-lfs-dir
20 tuning/tuning-change-lfs-dir
20 tuning/tuning-hg-auth-loop
21 tuning/tuning-hg-auth-loop
21
22
@@ -1,126 +1,118 b''
1 .. _increase-gunicorn:
1 .. _increase-gunicorn:
2
2
3 Configure Gunicorn Workers
3 Configure Gunicorn Workers
4 --------------------------
4 --------------------------
5
5
6
6
7 |RCE| comes with `Gunicorn`_ which is a Python WSGI HTTP Server for UNIX.
7 |RCE| comes with `Gunicorn`_ which is a Python WSGI HTTP Server for UNIX.
8
8
9 To improve |RCE| performance you can increase the number of `Gunicorn`_ workers.
9 To improve |RCE| performance you can increase the number of `Gunicorn`_ workers.
10 This allows to handle more connections concurrently, and provide better
10 This allows to handle more connections concurrently, and provide better
11 responsiveness and performance.
11 responsiveness and performance.
12
12
13 By default during installation |RCC| tries to detect how many CPUs are
13 By default during installation |RCC| tries to detect how many CPUs are
14 available in the system, and set the number workers based on that information.
14 available in the system, and set the number workers based on that information.
15 However sometimes it's better to manually set the number of workers.
15 However sometimes it's better to manually set the number of workers.
16
16
17 To do this, use the following steps:
17 To do this, use the following steps:
18
18
19 1. Open the :file:`home/{user}/.rccontrol/{instance-id}/rhodecode.ini` file.
19 1. Open the :file:`home/{user}/.rccontrol/{instance-id}/rhodecode.ini` file.
20 2. In the ``[server:main]`` section, change the number of Gunicorn
20 2. In the ``[server:main]`` section, change the number of Gunicorn
21 ``workers`` using the following default formula :math:`(2 * Cores) + 1`.
21 ``workers`` using the following default formula :math:`(2 * Cores) + 1`.
22 We however not recommend using more than 8-12 workers per server. It's better
22 We however not recommend using more than 8-12 workers per server. It's better
23 to start using the :ref:`scale-horizontal-cluster` in case that performance
23 to start using the :ref:`scale-horizontal-cluster` in case that performance
24 with 8-12 workers is not enough.
24 with 8-12 workers is not enough.
25
25
26 .. code-block:: ini
26 .. code-block:: ini
27
27
28 use = egg:gunicorn#main
28 ; Sets the number of process workers. More workers means more concurrent connections
29 ## Sets the number of process workers. You must set `instance_id = *`
29 ; RhodeCode can handle at the same time. Each additional worker also it increases
30 ## when this option is set to more than one worker, recommended
30 ; memory usage as each has it's own set of caches.
31 ## value is (2 * NUMBER_OF_CPUS + 1), eg 2CPU = 5 workers
31 ; Recommended value is (2 * NUMBER_OF_CPUS + 1), eg 2CPU = 5 workers, but no more
32 ## The `instance_id = *` must be set in the [app:main] section below
32 ; than 8-10 unless for really big deployments .e.g 700-1000 users.
33 workers = 4
33 ; `instance_id = *` must be set in the [app:main] section below (which is the default)
34 ## process name
34 ; when using more than 1 worker.
35 proc_name = rhodecode
35 workers = 6
36 ## type of worker class, one of sync, gevent
36
37 ## recommended for bigger setup is using of of other than sync one
37 ; Type of worker class, one of `sync`, `gevent`
38 worker_class = sync
38 ; Use `gevent` for rhodecode
39 ## The maximum number of simultaneous clients. Valid only for Gevent
39 worker_class = gevent
40 #worker_connections = 10
40
41 ## max number of requests that worker will handle before being gracefully
41 ; The maximum number of simultaneous clients per worker. Valid only for gevent
42 ## restarted, could prevent memory leaks
42 worker_connections = 10
43 max_requests = 1000
43
44 max_requests_jitter = 30
45 ## amount of time a worker can spend with handling a request tuning-change-lfs-dir.before it
46 ## gets killed and restarted. Set to 6hrs
47 timeout = 21600
48
44
49 3. In the ``[app:main]`` section, set the ``instance_id`` property to ``*``.
45 3. In the ``[app:main]`` section, set the ``instance_id`` property to ``*``.
50
46
51 .. code-block:: ini
47 .. code-block:: ini
52
48
53 # In the [app:main] section
49 # In the [app:main] section
54 [app:main]
50 [app:main]
55 # You must set `instance_id = *`
51 # You must set `instance_id = *`
56 instance_id = *
52 instance_id = *
57
53
58 4. Change the VCSServer workers too. Open the
54 4. Change the VCSServer workers too. Open the
59 :file:`home/{user}/.rccontrol/{instance-id}/vcsserver.ini` file.
55 :file:`home/{user}/.rccontrol/{instance-id}/vcsserver.ini` file.
60
56
61 5. In the ``[server:main]`` section, increase the number of Gunicorn
57 5. In the ``[server:main]`` section, increase the number of Gunicorn
62 ``workers`` using the following formula :math:`(2 * Cores) + 1`.
58 ``workers`` using the following formula :math:`(2 * Cores) + 1`.
63
59
64 .. code-block:: ini
60 .. code-block:: ini
65
61
66 ## run with gunicorn --log-config vcsserver.ini --paste vcsserver.ini
62 ; Sets the number of process workers. More workers means more concurrent connections
67 use = egg:gunicorn#main
63 ; RhodeCode can handle at the same time. Each additional worker also it increases
68 ## Sets the number of process workers. Recommended
64 ; memory usage as each has it's own set of caches.
69 ## value is (2 * NUMBER_OF_CPUS + 1), eg 2CPU = 5 workers
65 ; Recommended value is (2 * NUMBER_OF_CPUS + 1), eg 2CPU = 5 workers, but no more
70 workers = 4
66 ; than 8-10 unless for really big deployments .e.g 700-1000 users.
71 ## process name
67 ; `instance_id = *` must be set in the [app:main] section below (which is the default)
72 proc_name = rhodecode_vcsserver
68 ; when using more than 1 worker.
73 ## type of worker class, currently `sync` is the only option allowed.
69 workers = 8
70
71 ; Type of worker class, one of `sync`, `gevent`
72 ; Use `sync` for vcsserver
74 worker_class = sync
73 worker_class = sync
75 ## The maximum number of simultaneous clients. Valid only for Gevent
74
76 #worker_connections = 10
77 ## max number of requests that worker will handle before being gracefully
78 ## restarted, could prevent memory leaks
79 max_requests = 1000
80 max_requests_jitter = 30
81 ## amount of time a worker can spend with handling a request before it
82 ## gets killed and restarted. Set to 6hrs
83 timeout = 21600
84
75
85 6. Save your changes.
76 6. Save your changes.
86 7. Restart your |RCE| instances, using the following command:
77 7. Restart your |RCE| instances, using the following command:
87
78
88 .. code-block:: bash
79 .. code-block:: bash
89
80
90 $ rccontrol restart '*'
81 $ rccontrol restart '*'
91
82
92
83
93 Gunicorn Gevent Backend
84 Gunicorn Gevent Backend
94 -----------------------
85 -----------------------
95
86
96 Gevent is an asynchronous worker type for Gunicorn. It allows accepting multiple
87 Gevent is an asynchronous worker type for Gunicorn. It allows accepting multiple
97 connections on a single `Gunicorn`_ worker. This means you can handle 100s
88 connections on a single `Gunicorn`_ worker. This means you can handle 100s
98 of concurrent clones, or API calls using just few workers. A setting called
89 of concurrent clones, or API calls using just few workers. A setting called
99 `worker_connections` defines on how many connections each worker can
90 `worker_connections` defines on how many connections each worker can
100 handle using `Gevent`.
91 handle using `Gevent`.
101
92
102
93
103 To enable `Gevent` on |RCE| do the following:
94 To enable `Gevent` on |RCE| do the following:
104
95
105
96
106 1. Open the :file:`home/{user}/.rccontrol/{instance-id}/rhodecode.ini` file.
97 1. Open the :file:`home/{user}/.rccontrol/{instance-id}/rhodecode.ini` file.
107 2. In the ``[server:main]`` section, change `worker_class` for Gunicorn.
98 2. In the ``[server:main]`` section, change `worker_class` for Gunicorn.
108
99
109
100
110 .. code-block:: ini
101 .. code-block:: ini
111
102
112 ## type of worker class, one of sync, gevent
103 ; Type of worker class, one of `sync`, `gevent`
113 ## recommended for bigger setup is using of of other than sync one
104 ; Use `gevent` for rhodecode
114 worker_class = gevent
105 worker_class = gevent
115 ## The maximum number of simultaneous clients. Valid only for Gevent
106
107 ; The maximum number of simultaneous clients per worker. Valid only for gevent
116 worker_connections = 30
108 worker_connections = 30
117
109
118
110
119 .. note::
111 .. note::
120
112
121 `Gevent` is currently only supported for Enterprise/Community instances.
113 `Gevent` is currently only supported for Enterprise/Community instances.
122 VCSServer doesn't yet support gevent.
114 VCSServer doesn't support gevent.
123
115
124
116
125
117
126 .. _Gunicorn: http://gunicorn.org/
118 .. _Gunicorn: http://gunicorn.org/
@@ -1,8 +1,26 b''
1 .. _adjust-vcs-mem-cache:
1 .. _adjust-vcs-server-mem:
2
2
3 VCSServer Memory Cache
3 VCSServer Memory Usage
4 ----------------------
4 ----------------------
5
5
6 The VCS Server mamory cache can be adjusted to work best with the resources
6 Starting from Version 4.18.X RhodeCode has a builtin memory monitor for gunicorn workers.
7 available to your |RCE| instance. If you find that memory resources are under
7 Enabling this can limit the maximum amount of memory system can use. Each worker
8 pressure, see the :ref:`vcs-server-maintain` section for details.
8 for VCS Server is monitored independently.
9 To enable Memory management make sure to have following settings inside `[app:main] section` of
10 :file:`home/{user}/.rccontrol/{instance-id}/vcsserver.ini` file.
11
12
13
14 ; Maximum memory usage that each worker can use before it will receive a
15 ; graceful restart signal 0 = memory monitoring is disabled
16 ; Examples: 268435456 (256MB), 536870912 (512MB)
17 ; 1073741824 (1GB), 2147483648 (2GB), 4294967296 (4GB)
18 memory_max_usage = 1073741824
19
20 ; How often in seconds to check for memory usage for each gunicorn worker
21 memory_usage_check_interval = 60
22
23 ; Threshold value for which we don't recycle worker if GarbageCollection
24 ; frees up enough resources. Before each restart we try to run GC on worker
25 ; in case we get enough free memory after that, restart will not happen.
26 memory_usage_recovery_threshold = 0.8
@@ -1,324 +1,379 b''
1 .. _vcs-server:
1 .. _vcs-server:
2
2
3 VCS Server Management
3 VCS Server Management
4 ---------------------
4 ---------------------
5
5
6 The VCS Server handles |RCE| backend functionality. You need to configure
6 The VCS Server handles |RCE| backend functionality. You need to configure
7 a VCS Server to run with a |RCE| instance. If you do not, you will be missing
7 a VCS Server to run with a |RCE| instance. If you do not, you will be missing
8 the connection between |RCE| and its |repos|. This will cause error messages
8 the connection between |RCE| and its |repos|. This will cause error messages
9 on the web interface. You can run your setup in the following configurations,
9 on the web interface. You can run your setup in the following configurations,
10 currently the best performance is one of following:
10 currently the best performance is one of following:
11
11
12 * One VCS Server per |RCE| instance.
12 * One VCS Server per |RCE| instance.
13 * One VCS Server handling multiple instances.
13 * One VCS Server handling multiple instances.
14
14
15 .. important::
15 .. important::
16
16
17 If your server locale settings are not correctly configured,
17 If your server locale settings are not correctly configured,
18 |RCE| and the VCS Server can run into issues. See this `Ask Ubuntu`_ post
18 |RCE| and the VCS Server can run into issues. See this `Ask Ubuntu`_ post
19 which explains the problem and gives a solution.
19 which explains the problem and gives a solution.
20
20
21 For more information, see the following sections:
21 For more information, see the following sections:
22
22
23 * :ref:`install-vcs`
23 * :ref:`install-vcs`
24 * :ref:`config-vcs`
24 * :ref:`config-vcs`
25 * :ref:`vcs-server-options`
25 * :ref:`vcs-server-options`
26 * :ref:`vcs-server-versions`
26 * :ref:`vcs-server-versions`
27 * :ref:`vcs-server-maintain`
27 * :ref:`vcs-server-maintain`
28 * :ref:`vcs-server-config-file`
28 * :ref:`vcs-server-config-file`
29 * :ref:`svn-http`
29 * :ref:`svn-http`
30
30
31 .. _install-vcs:
31 .. _install-vcs:
32
32
33 VCS Server Installation
33 VCS Server Installation
34 ^^^^^^^^^^^^^^^^^^^^^^^
34 ^^^^^^^^^^^^^^^^^^^^^^^
35
35
36 To install a VCS Server, see
36 To install a VCS Server, see
37 :ref:`Installing a VCS server <control:install-vcsserver>`.
37 :ref:`Installing a VCS server <control:install-vcsserver>`.
38
38
39 .. _config-vcs:
39 .. _config-vcs:
40
40
41 Hooking |RCE| to its VCS Server
41 Hooking |RCE| to its VCS Server
42 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
42 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
43
43
44 To configure a |RCE| instance to use a VCS server, see
44 To configure a |RCE| instance to use a VCS server, see
45 :ref:`Configuring the VCS Server connection <control:manually-vcsserver-ini>`.
45 :ref:`Configuring the VCS Server connection <control:manually-vcsserver-ini>`.
46
46
47 .. _vcs-server-options:
47 .. _vcs-server-options:
48
48
49 |RCE| VCS Server Options
49 |RCE| VCS Server Options
50 ^^^^^^^^^^^^^^^^^^^^^^^^
50 ^^^^^^^^^^^^^^^^^^^^^^^^
51
51
52 The following list shows the available options on the |RCE| side of the
52 The following list shows the available options on the |RCE| side of the
53 connection to the VCS Server. The settings are configured per
53 connection to the VCS Server. The settings are configured per
54 instance in the
54 instance in the
55 :file:`/home/{user}/.rccontrol/{instance-id}/rhodecode.ini` file.
55 :file:`/home/{user}/.rccontrol/{instance-id}/rhodecode.ini` file.
56
56
57 .. rst-class:: dl-horizontal
57 .. rst-class:: dl-horizontal
58
58
59 \vcs.backends <available-vcs-systems>
59 \vcs.backends <available-vcs-systems>
60 Set a comma-separated list of the |repo| options available from the
60 Set a comma-separated list of the |repo| options available from the
61 web interface. The default is ``hg, git, svn``,
61 web interface. The default is ``hg, git, svn``,
62 which is all |repo| types available. The order of backends is also the
62 which is all |repo| types available. The order of backends is also the
63 order backend will try to detect requests type.
63 order backend will try to detect requests type.
64
64
65 \vcs.connection_timeout <seconds>
65 \vcs.connection_timeout <seconds>
66 Set the length of time in seconds that the VCS Server waits for
66 Set the length of time in seconds that the VCS Server waits for
67 requests to process. After the timeout expires,
67 requests to process. After the timeout expires,
68 the request is closed. The default is ``3600``. Set to a higher
68 the request is closed. The default is ``3600``. Set to a higher
69 number if you experience network latency, or timeout issues with very
69 number if you experience network latency, or timeout issues with very
70 large push/pull requests.
70 large push/pull requests.
71
71
72 \vcs.server.enable <boolean>
72 \vcs.server.enable <boolean>
73 Enable or disable the VCS Server. The available options are ``true`` or
73 Enable or disable the VCS Server. The available options are ``true`` or
74 ``false``. The default is ``true``.
74 ``false``. The default is ``true``.
75
75
76 \vcs.server <host:port>
76 \vcs.server <host:port>
77 Set the host, either hostname or IP Address, and port of the VCS server
77 Set the host, either hostname or IP Address, and port of the VCS server
78 you wish to run with your |RCE| instance.
78 you wish to run with your |RCE| instance.
79
79
80 .. code-block:: ini
80 .. code-block:: ini
81
81
82 ##################
82 ##################
83 ### VCS CONFIG ###
83 ### VCS CONFIG ###
84 ##################
84 ##################
85 # set this line to match your VCS Server
85 # set this line to match your VCS Server
86 vcs.server = 127.0.0.1:10004
86 vcs.server = 127.0.0.1:10004
87 # Set to False to disable the VCS Server
87 # Set to False to disable the VCS Server
88 vcs.server.enable = True
88 vcs.server.enable = True
89 vcs.backends = hg, git, svn
89 vcs.backends = hg, git, svn
90 vcs.connection_timeout = 3600
90 vcs.connection_timeout = 3600
91
91
92
92
93 .. _vcs-server-versions:
93 .. _vcs-server-versions:
94
94
95 VCS Server Versions
95 VCS Server Versions
96 ^^^^^^^^^^^^^^^^^^^
96 ^^^^^^^^^^^^^^^^^^^
97
97
98 An updated version of the VCS Server is released with each |RCE| version. Use
98 An updated version of the VCS Server is released with each |RCE| version. Use
99 the VCS Server number that matches with the |RCE| version to pair the
99 the VCS Server number that matches with the |RCE| version to pair the
100 appropriate ones together. For |RCE| versions pre 3.3.0,
100 appropriate ones together. For |RCE| versions pre 3.3.0,
101 VCS Server 1.X.Y works with |RCE| 3.X.Y, for example:
101 VCS Server 1.X.Y works with |RCE| 3.X.Y, for example:
102
102
103 * VCS Server 1.0.0 works with |RCE| 3.0.0
103 * VCS Server 1.0.0 works with |RCE| 3.0.0
104 * VCS Server 1.2.2 works with |RCE| 3.2.2
104 * VCS Server 1.2.2 works with |RCE| 3.2.2
105
105
106 For |RCE| versions post 3.3.0, the VCS Server and |RCE| version numbers
106 For |RCE| versions post 3.3.0, the VCS Server and |RCE| version numbers
107 match, for example:
107 match, for example:
108
108
109 * VCS Server |release| works with |RCE| |release|
109 * VCS Server |release| works with |RCE| |release|
110
110
111 .. _vcs-server-maintain:
111 .. _vcs-server-maintain:
112
112
113 VCS Server Memory Optimization
113 VCS Server Cache Optimization
114 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
114 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
115
115
116 To optimize the VCS server to manage the cache and memory usage efficiently, you need to
116 To optimize the VCS server to manage the cache and memory usage efficiently, it's recommended to
117 configure the following options in the
117 configure the Redis backend for VCSServer caches.
118 :file:`/home/{user}/.rccontrol/{vcsserver-id}/vcsserver.ini` file. Once
118 Once configured, restart the VCS Server.
119 configured, restart the VCS Server. By default we use an optimal settings, but in certain
119
120 conditions tunning expiration_time and max_size can affect memory usage and performance
120 Make sure Redis is installed and running.
121 Open :file:`/home/{user}/.rccontrol/{vcsserver-id}/vcsserver.ini`
122 file and ensure the below settings for `repo_object` type cache are set:
121
123
122 .. code-block:: ini
124 .. code-block:: ini
123
125
124 ## cache region for storing repo_objects cache
126 ; ensure the default file based cache is *commented out*
125 rc_cache.repo_object.backend = dogpile.cache.rc.memory_lru
127 ##rc_cache.repo_object.backend = dogpile.cache.rc.file_namespace
128 ##rc_cache.repo_object.expiration_time = 2592000
126
129
127 ## cache auto-expires after N seconds, setting this to 0 disabled cache
130 ; `repo_object` cache settings for vcs methods for repositories
128 rc_cache.repo_object.expiration_time = 300
131 rc_cache.repo_object.backend = dogpile.cache.rc.redis_msgpack
129
132
130 ## max size of LRU, old values will be discarded if the size of cache reaches max_size
133 ; cache auto-expires after N seconds
131 ## Sets the maximum number of items stored in the cache, before the cache
134 ; Examples: 86400 (1Day), 604800 (7Days), 1209600 (14Days), 2592000 (30days), 7776000 (90Days)
132 ## starts to be cleared.
135 rc_cache.repo_object.expiration_time = 2592000
136
137 ; redis_expiration_time needs to be greater then expiration_time
138 rc_cache.repo_object.arguments.redis_expiration_time = 3592000
133
139
134 ## As a general rule of thumb, running this value at 120 resulted in a
140 rc_cache.repo_object.arguments.host = localhost
135 ## 5GB cache. Running it at 240 resulted in a 9GB cache. Your results
141 rc_cache.repo_object.arguments.port = 6379
136 ## will differ based on usage patterns and |repo| sizes.
142 rc_cache.repo_object.arguments.db = 5
137
143 rc_cache.repo_object.arguments.socket_timeout = 30
138 ## Tweaking this value to run at a fairly constant memory load on your
144 ; more Redis options: https://dogpilecache.sqlalchemy.org/en/latest/api.html#redis-backends
139 ## server will help performance.
145 rc_cache.repo_object.arguments.distributed_lock = true
140
141 rc_cache.repo_object.max_size = 120
142
146
143
147
144 To clear the cache completely, you can restart the VCS Server.
148 To clear the cache completely, you can restart the VCS Server.
145
149
146 .. important::
150 .. important::
147
151
148 While the VCS Server handles a restart gracefully on the web interface,
152 While the VCS Server handles a restart gracefully on the web interface,
149 it will drop connections during push/pull requests. So it is recommended
153 it will drop connections during push/pull requests. So it is recommended
150 you only perform this when there is very little traffic on the instance.
154 you only perform this when there is very little traffic on the instance.
151
155
152 Use the following example to restart your VCS Server,
156 Use the following example to restart your VCS Server,
153 for full details see the :ref:`RhodeCode Control CLI <control:rcc-cli>`.
157 for full details see the :ref:`RhodeCode Control CLI <control:rcc-cli>`.
154
158
155 .. code-block:: bash
159 .. code-block:: bash
156
160
157 $ rccontrol status
161 $ rccontrol status
158
162
159 .. code-block:: vim
163 .. code-block:: vim
160
164
161 - NAME: vcsserver-1
165 - NAME: vcsserver-1
162 - STATUS: RUNNING
166 - STATUS: RUNNING
163 logs:/home/ubuntu/.rccontrol/vcsserver-1/vcsserver.log
167 logs:/home/ubuntu/.rccontrol/vcsserver-1/vcsserver.log
164 - VERSION: 4.7.2 VCSServer
168 - VERSION: 4.7.2 VCSServer
165 - URL: http://127.0.0.1:10008
169 - URL: http://127.0.0.1:10008
166 - CONFIG: /home/ubuntu/.rccontrol/vcsserver-1/vcsserver.ini
170 - CONFIG: /home/ubuntu/.rccontrol/vcsserver-1/vcsserver.ini
167
171
168 $ rccontrol restart vcsserver-1
172 $ rccontrol restart vcsserver-1
169 Instance "vcsserver-1" successfully stopped.
173 Instance "vcsserver-1" successfully stopped.
170 Instance "vcsserver-1" successfully started.
174 Instance "vcsserver-1" successfully started.
171
175
172 .. _vcs-server-config-file:
176 .. _vcs-server-config-file:
173
177
174 VCS Server Configuration
178 VCS Server Configuration
175 ^^^^^^^^^^^^^^^^^^^^^^^^
179 ^^^^^^^^^^^^^^^^^^^^^^^^
176
180
177 You can configure settings for multiple VCS Servers on your
181 You can configure settings for multiple VCS Servers on your
178 system using their individual configuration files. Use the following
182 system using their individual configuration files. Use the following
179 properties inside the configuration file to set up your system. The default
183 properties inside the configuration file to set up your system. The default
180 location is :file:`home/{user}/.rccontrol/{vcsserver-id}/vcsserver.ini`.
184 location is :file:`home/{user}/.rccontrol/{vcsserver-id}/vcsserver.ini`.
181 For a more detailed explanation of the logger levers, see :ref:`debug-mode`.
185 For a more detailed explanation of the logger levers, see :ref:`debug-mode`.
182
186
183 .. rst-class:: dl-horizontal
187 .. rst-class:: dl-horizontal
184
188
185 \host <ip-address>
189 \host <ip-address>
186 Set the host on which the VCS Server will run. VCSServer is not
190 Set the host on which the VCS Server will run. VCSServer is not
187 protected by any authentication, so we *highly* recommend running it
191 protected by any authentication, so we *highly* recommend running it
188 under localhost ip that is `127.0.0.1`
192 under localhost ip that is `127.0.0.1`
189
193
190 \port <int>
194 \port <int>
191 Set the port number on which the VCS Server will be available.
195 Set the port number on which the VCS Server will be available.
192
196
193 \locale <locale_utf>
194 Set the locale the VCS Server expects.
195
196 \workers <int>
197 Set the number of process workers.Recommended
198 value is (2 * NUMBER_OF_CPUS + 1), eg 2CPU = 5 workers
199
200 \max_requests <int>
201 The maximum number of requests a worker will process before restarting.
202 Any value greater than zero will limit the number of requests a work
203 will process before automatically restarting. This is a simple method
204 to help limit the damage of memory leaks.
205
206 \max_requests_jitter <int>
207 The maximum jitter to add to the max_requests setting.
208 The jitter causes the restart per worker to be randomized by
209 randint(0, max_requests_jitter). This is intended to stagger worker
210 restarts to avoid all workers restarting at the same time.
211
212
197
213 .. note::
198 .. note::
214
199
215 After making changes, you need to restart your VCS Server to pick them up.
200 After making changes, you need to restart your VCS Server to pick them up.
216
201
217 .. code-block:: ini
202 .. code-block:: ini
218
203
219 ################################################################################
204 ; #################################
220 # RhodeCode VCSServer with HTTP Backend - configuration #
205 ; RHODECODE VCSSERVER CONFIGURATION
221 # #
206 ; #################################
222 ################################################################################
223
224
207
225 [server:main]
208 [server:main]
226 ## COMMON ##
209 ; COMMON HOST/IP CONFIG
227 host = 127.0.0.1
210 host = 127.0.0.1
228 port = 10002
211 port = 10002
229
212
230 ##########################
213 ; ###########################
231 ## GUNICORN WSGI SERVER ##
214 ; GUNICORN APPLICATION SERVER
232 ##########################
215 ; ###########################
233 ## run with gunicorn --log-config vcsserver.ini --paste vcsserver.ini
216
217 ; run with gunicorn --log-config rhodecode.ini --paste rhodecode.ini
218
219 ; Module to use, this setting shouldn't be changed
234 use = egg:gunicorn#main
220 use = egg:gunicorn#main
235 ## Sets the number of process workers. Recommended
221
236 ## value is (2 * NUMBER_OF_CPUS + 1), eg 2CPU = 5 workers
222 ; Sets the number of process workers. More workers means more concurrent connections
237 workers = 3
223 ; RhodeCode can handle at the same time. Each additional worker also it increases
238 ## process name
224 ; memory usage as each has it's own set of caches.
225 ; Recommended value is (2 * NUMBER_OF_CPUS + 1), eg 2CPU = 5 workers, but no more
226 ; than 8-10 unless for really big deployments .e.g 700-1000 users.
227 ; `instance_id = *` must be set in the [app:main] section below (which is the default)
228 ; when using more than 1 worker.
229 workers = 6
230
231 ; Gunicorn access log level
232 loglevel = info
233
234 ; Process name visible in process list
239 proc_name = rhodecode_vcsserver
235 proc_name = rhodecode_vcsserver
240 ## type of worker class, one of sync, gevent
236
241 ## recommended for bigger setup is using of of other than sync one
237 ; Type of worker class, one of sync, gevent
238 ; currently `sync` is the only option allowed.
242 worker_class = sync
239 worker_class = sync
243 ## The maximum number of simultaneous clients. Valid only for Gevent
240
244 #worker_connections = 10
241 ; The maximum number of simultaneous clients. Valid only for gevent
245 ## max number of requests that worker will handle before being gracefully
242 worker_connections = 10
246 ## restarted, could prevent memory leaks
243
244 ; Max number of requests that worker will handle before being gracefully restarted.
245 ; Prevents memory leaks, jitter adds variability so not all workers are restarted at once.
247 max_requests = 1000
246 max_requests = 1000
248 max_requests_jitter = 30
247 max_requests_jitter = 30
249 ## amount of time a worker can spend with handling a request before it
248
250 ## gets killed and restarted. Set to 6hrs
249 ; Amount of time a worker can spend with handling a request before it
250 ; gets killed and restarted. By default set to 21600 (6hrs)
251 ; Examples: 1800 (30min), 3600 (1hr), 7200 (2hr), 43200 (12h)
251 timeout = 21600
252 timeout = 21600
252
253
254 ; The maximum size of HTTP request line in bytes.
255 ; 0 for unlimited
256 limit_request_line = 0
257
258 ; Limit the number of HTTP headers fields in a request.
259 ; By default this value is 100 and can't be larger than 32768.
260 limit_request_fields = 32768
261
262 ; Limit the allowed size of an HTTP request header field.
263 ; Value is a positive number or 0.
264 ; Setting it to 0 will allow unlimited header field sizes.
265 limit_request_field_size = 0
266
267 ; Timeout for graceful workers restart.
268 ; After receiving a restart signal, workers have this much time to finish
269 ; serving requests. Workers still alive after the timeout (starting from the
270 ; receipt of the restart signal) are force killed.
271 ; Examples: 1800 (30min), 3600 (1hr), 7200 (2hr), 43200 (12h)
272 graceful_timeout = 3600
273
274 # The number of seconds to wait for requests on a Keep-Alive connection.
275 # Generally set in the 1-5 seconds range.
276 keepalive = 2
277
278 ; Maximum memory usage that each worker can use before it will receive a
279 ; graceful restart signal 0 = memory monitoring is disabled
280 ; Examples: 268435456 (256MB), 536870912 (512MB)
281 ; 1073741824 (1GB), 2147483648 (2GB), 4294967296 (4GB)
282 memory_max_usage = 1073741824
283
284 ; How often in seconds to check for memory usage for each gunicorn worker
285 memory_usage_check_interval = 60
286
287 ; Threshold value for which we don't recycle worker if GarbageCollection
288 ; frees up enough resources. Before each restart we try to run GC on worker
289 ; in case we get enough free memory after that, restart will not happen.
290 memory_usage_recovery_threshold = 0.8
291
292
253 [app:main]
293 [app:main]
254 use = egg:rhodecode-vcsserver
294 use = egg:rhodecode-vcsserver
255
295
256 pyramid.default_locale_name = en
296 pyramid.default_locale_name = en
257 pyramid.includes =
297 pyramid.includes =
258
298
259 ## default locale used by VCS systems
299 ; default locale used by VCS systems
260 locale = en_US.UTF-8
300 locale = en_US.UTF-8
261
301
262 # cache regions, please don't change
302 ; #############
263 beaker.cache.regions = repo_object
303 ; DOGPILE CACHE
264 beaker.cache.repo_object.type = memorylru
304 ; #############
265 beaker.cache.repo_object.max_items = 100
305
266 # cache auto-expires after N seconds
306 ; Default cache dir for caches. Putting this into a ramdisk can boost performance.
267 beaker.cache.repo_object.expire = 300
307 ; eg. /tmpfs/data_ramdisk, however this directory might require large amount of space
268 beaker.cache.repo_object.enabled = true
308 cache_dir = %(here)s/data
309
310 ; **********************************************************
311 ; `repo_object` cache with redis backend
312 ; recommended for larger instance, or for better performance
313 ; **********************************************************
314
315 ; `repo_object` cache settings for vcs methods for repositories
316 rc_cache.repo_object.backend = dogpile.cache.rc.redis_msgpack
269
317
318 ; cache auto-expires after N seconds
319 ; Examples: 86400 (1Day), 604800 (7Days), 1209600 (14Days), 2592000 (30days), 7776000 (90Days)
320 rc_cache.repo_object.expiration_time = 2592000
270
321
271 ################################
322 ; redis_expiration_time needs to be greater then expiration_time
272 ### LOGGING CONFIGURATION ####
323 rc_cache.repo_object.arguments.redis_expiration_time = 3592000
273 ################################
324
325 rc_cache.repo_object.arguments.host = localhost
326 rc_cache.repo_object.arguments.port = 6379
327 rc_cache.repo_object.arguments.db = 5
328 rc_cache.repo_object.arguments.socket_timeout = 30
329 ; more Redis options: https://dogpilecache.sqlalchemy.org/en/latest/api.html#redis-backends
330 rc_cache.repo_object.arguments.distributed_lock = true
331
332 ; #####################
333 ; LOGGING CONFIGURATION
334 ; #####################
274 [loggers]
335 [loggers]
275 keys = root, vcsserver, beaker
336 keys = root, vcsserver
276
337
277 [handlers]
338 [handlers]
278 keys = console
339 keys = console
279
340
280 [formatters]
341 [formatters]
281 keys = generic
342 keys = generic
282
343
283 #############
344 ; #######
284 ## LOGGERS ##
345 ; LOGGERS
285 #############
346 ; #######
286 [logger_root]
347 [logger_root]
287 level = NOTSET
348 level = NOTSET
288 handlers = console
349 handlers = console
289
350
290 [logger_vcsserver]
351 [logger_vcsserver]
291 level = DEBUG
352 level = DEBUG
292 handlers =
353 handlers =
293 qualname = vcsserver
354 qualname = vcsserver
294 propagate = 1
355 propagate = 1
295
356
296 [logger_beaker]
297 level = DEBUG
298 handlers =
299 qualname = beaker
300 propagate = 1
301
357
302
358 ; ########
303 ##############
359 ; HANDLERS
304 ## HANDLERS ##
360 ; ########
305 ##############
306
361
307 [handler_console]
362 [handler_console]
308 class = StreamHandler
363 class = StreamHandler
309 args = (sys.stderr,)
364 args = (sys.stderr, )
310 level = DEBUG
365 level = INFO
311 formatter = generic
366 formatter = generic
312
367
313 ################
368 ; ##########
314 ## FORMATTERS ##
369 ; FORMATTERS
315 ################
370 ; ##########
316
371
317 [formatter_generic]
372 [formatter_generic]
318 format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
373 format = %(asctime)s.%(msecs)03d [%(process)d] %(levelname)-5.5s [%(name)s] %(message)s
319 datefmt = %Y-%m-%d %H:%M:%S
374 datefmt = %Y-%m-%d %H:%M:%S
320
375
321
376
322 .. _Subversion Red Book: http://svnbook.red-bean.com/en/1.7/svn-book.html#svn.ref.svn
377 .. _Subversion Red Book: http://svnbook.red-bean.com/en/1.7/svn-book.html#svn.ref.svn
323
378
324 .. _Ask Ubuntu: http://askubuntu.com/questions/162391/how-do-i-fix-my-locale-issue
379 .. _Ask Ubuntu: http://askubuntu.com/questions/162391/how-do-i-fix-my-locale-issue
General Comments 0
You need to be logged in to leave comments. Login now