##// END OF EJS Templates
extensions: preparatory refactoring...
extensions: preparatory refactoring Small refactoring: - use 'try..except' rather than 'if-then', which removes the need for a separate 'path' variable and is more 'pythonic'. - promote log from 'debug' to 'info' and execute it immediately after loading before anything else. - clarify comments related to INDEX_EXTENSIONS

File last commit:

r8370:d442d839 default
r8420:2228102b default
Show More
performance.rst
125 lines | 4.9 KiB | text/x-rst | RstLexer
Added simple docs for optimizing RhodeCode performance
r2517 .. _performance:
================================
Mads Kiilerich
docs: cleanup of casing, markup and spacing of headings...
r5413 Optimizing Kallithea performance
Added simple docs for optimizing RhodeCode performance
r2517 ================================
Mads Kiilerich
docs: tweak formatting of the performance page - replace the odd numbered list with sections
r6337 When serving a large amount of big repositories, Kallithea can start performing
slower than expected. Because of the demanding nature of handling large amounts
of data from version control systems, here are some tips on how to get the best
performance.
docs improvements
r2775
Mads Kiilerich
docs: tweak formatting of the performance page - replace the odd numbered list with sections
r6337 Fast storage
------------
Added simple docs for optimizing RhodeCode performance
r2517
Mads Kiilerich
docs: tweak formatting of the performance page - replace the odd numbered list with sections
r6337 Kallithea is often I/O bound, and hence a fast disk (SSD/SAN) and plenty of RAM
is usually more important than a fast CPU.
Mads Kiilerich
db: get rid of vcs_full_cache - it should always be used...
r5739
Mads Kiilerich
docs: tweak formatting of the performance page - replace the odd numbered list with sections
r6337 Caching
-------
Added simple docs for optimizing RhodeCode performance
r2517
Mads Kiilerich
docs: tweak formatting of the performance page - replace the odd numbered list with sections
r6337 Tweak beaker cache settings in the ini file. The actual effect of that is
questionable.
Mads Kiilerich
docs: document official method for beaker cache cleanup
r7840 .. note::
Beaker has no upper bound on cache size and will never drop any caches. For
memory cache, the only option is to regularly restart the worker process.
For file cache, it must be cleaned manually, as described in the `Beaker
documentation <https://beaker.readthedocs.io/en/latest/sessions.html#removing-expired-old-sessions>`_::
find data/cache -type f -mtime +30 -print -exec rm {} \;
Added simple docs for optimizing RhodeCode performance
r2517
Mads Kiilerich
docs: tweak formatting of the performance page - replace the odd numbered list with sections
r6337 Database
--------
whitespace cleanup
r3224
Mads Kiilerich
docs: tweak formatting of the performance page - replace the odd numbered list with sections
r6337 SQLite is a good option when having a small load on the system. But due to
locking issues with SQLite, it is not recommended to use it for larger
deployments.
whitespace cleanup
r3224
Mads Kiilerich
docs: clarify that MariaDB is supported, with slight preference for this more free option
r8313 Switching to PostgreSQL or MariaDB/MySQL will result in an immediate performance
Mads Kiilerich
docs: tweak formatting of the performance page - replace the odd numbered list with sections
r6337 increase. A tool like SQLAlchemyGrate_ can be used for migrating to another
database platform.
Added simple docs for optimizing RhodeCode performance
r2517
Mads Kiilerich
docs: tweak formatting of the performance page - replace the odd numbered list with sections
r6337 Horizontal scaling
------------------
Mads Kiilerich
config: clarify that we only recommend and support single threaded operation...
r6116
Mads Kiilerich
docs: clarify section on horizontal scaling - multi threading is not supported at all
r8362 Scaling horizontally means running several Kallithea instances (also known as
worker processes) and let them share the load. That is essential to serve other
users while processing a long-running request from a user. Usually, the
bottleneck on a Kallithea server is not CPU but I/O speed - especially network
speed. It is thus a good idea to run multiple worker processes on one server.
Mads Kiilerich
scripts: fix X mode on code formatting scripts
r6179
Mads Kiilerich
docs: clarify section on horizontal scaling - multi threading is not supported at all
r8362 .. note::
Mads Kiilerich
docs: tweak formatting of the performance page - replace the odd numbered list with sections
r6337
Mads Kiilerich
docs: clarify section on horizontal scaling - multi threading is not supported at all
r8362 Kallithea and the embedded Mercurial backend are not thread-safe. Each
worker process must thus be single-threaded.
Mads Kiilerich
config: clarify that we only recommend and support single threaded operation...
r6116
Mads Kiilerich
docs: clarify section on horizontal scaling - multi threading is not supported at all
r8362 Web servers can usually launch multiple worker processes - for example ``mod_wsgi`` with the
``WSGIDaemonProcess`` ``processes`` parameter or ``uWSGI`` or ``gunicorn`` with
their ``workers`` setting.
Mads Kiilerich
config: clarify that we only recommend and support single threaded operation...
r6116
Mads Kiilerich
docs: clarify section on horizontal scaling - multi threading is not supported at all
r8362 Kallithea can also be scaled horizontally across multiple machines.
Mads Kiilerich
docs: tweak formatting of the performance page - replace the odd numbered list with sections
r6337 In order to scale horizontally on multiple machines, you need to do the
following:
whitespace cleanup
r3413
Thomas De Schampheleire
docs: reduce double nesting level in performance.rst...
r8370 - Each instance's ``data`` storage needs to be configured to be stored on a
shared disk storage, preferably together with repositories. This ``data``
dir contains template caches, sessions, whoosh index and is used for
task locking (so it is safe across multiple instances). Set the
``cache_dir``, ``index_dir``, ``beaker.cache.data_dir``, ``beaker.cache.lock_dir``
variables in each .ini file to a shared location across Kallithea instances
- If using several Celery instances,
the message broker should be common to all of them (e.g., one
shared RabbitMQ server)
- Load balance using round robin or IP hash, recommended is writing LB rules
that will separate regular user traffic from automated processes like CI
servers or build bots.
Anatoly Bubenkov
docs: add a reference to https://github.com/shazow/sqlalchemygrate for migration from sqlite to other dbs
r5060
Mads Kiilerich
docs: tweak formatting of the performance page - replace the odd numbered list with sections
r6337
Serve static files directly from the web server
-----------------------------------------------
Mads Kiilerich
docs: mention use of static_files, it's setup and implications
r5843
With the default ``static_files`` ini setting, the Kallithea WSGI application
Mads Kiilerich
middleware: drop gzipper middleware...
r6338 will take care of serving the static files from ``kallithea/public/`` at the
root of the application URL.
Mads Kiilerich
docs: mention use of static_files, it's setup and implications
r5843
Mads Kiilerich
middleware: drop gzipper middleware...
r6338 The actual serving of the static files is very fast and unlikely to be a
problem in a Kallithea setup - the responses generated by Kallithea from
database and repository content will take significantly more time and
resources.
Mads Kiilerich
docs: mention use of static_files, it's setup and implications
r5843
To serve static files from the web server, use something like this Apache config
snippet::
Alias /images/ /srv/kallithea/kallithea/kallithea/public/images/
Alias /css/ /srv/kallithea/kallithea/kallithea/public/css/
Alias /js/ /srv/kallithea/kallithea/kallithea/public/js/
Alias /codemirror/ /srv/kallithea/kallithea/kallithea/public/codemirror/
Alias /fontello/ /srv/kallithea/kallithea/kallithea/public/fontello/
Then disable serving of static files in the ``.ini`` ``app:main`` section::
static_files = false
If using Kallithea installed as a package, you should be able to find the files
Mads Kiilerich
middleware: drop gzipper middleware...
r6338 under ``site-packages/kallithea``, either in your Python installation or in your
Mads Kiilerich
docs: mention use of static_files, it's setup and implications
r5843 virtualenv. When upgrading, make sure to update the web server configuration
too if necessary.
Mads Kiilerich
middleware: drop gzipper middleware...
r6338 It might also be possible to improve performance by configuring the web server
to compress responses (served from static files or generated by Kallithea) when
serving them. That might also imply buffering of responses - that is more
likely to be a problem; large responses (clones or pulls) will have to be fully
processed and spooled to disk or memory before the client will see any
response. See the documentation for your web server.
Mads Kiilerich
docs: consistent spacing around headings...
r5433
Anatoly Bubenkov
docs: add a reference to https://github.com/shazow/sqlalchemygrate for migration from sqlite to other dbs
r5060 .. _SQLAlchemyGrate: https://github.com/shazow/sqlalchemygrate
Mads Kiilerich
docs: clarify section on horizontal scaling - multi threading is not supported at all
r8362 .. _mod_wsgi: https://modwsgi.readthedocs.io/
.. _uWSGI: https://uwsgi-docs.readthedocs.io/
.. _gunicorn: http://pypi.python.org/pypi/gunicorn