# Optimization

This page lists extra optional software you can install to improve Pootle’s performance. Some configuration tips are given too.

## Optional Software

By installing optional software you can gain performance and extra features.

### Database Backends

You should really switch to a real database backend in production environments. Adjust the `DATABASES` setting accordingly.

MySQL-python
  MySQL adapter for Python.
Psycopg2
  PostgreSQL adapter for Python.

### Caching

Fast and efficient caching avoids hitting the DB when it’s not really needed. Adjust the `CACHES` setting accordingly.

python-memcached Efficient caching.

### Indexing Engines

Installing an indexing engine will speed-up searches. Pootle will automatically pick one from any of the available engines.

Xapian
  Python bindings for Xapian [1].
PyLucene
  Python bindings for Lucene.

Note

[1] | Xapian versions before 1.0.13 are incompatible with Apache; Pootle will detect Xapian version and disable indexing when running under mod_wsgi if needed. Checking for Xapian relies on the xapian-check command, which is found in the xapian-tools package in Debian-based systems.

### Web Servers

You should really run Pootle behind a real web server, at least to serve static content. For generating the dynamic content, you can also use alternative WSGI servers that might better suit your environment.

Apache
  Apache web server.
Nginx
  Ngninx web server.
gunicorn
  Python WSGI HTTP server.

### Speed-ups and Extras

zip and unzip
  Fast (un)compression of file archives.
python-Levenshtein
  Provides speed-up when updating against templates.
iso-codes
  Enables translated language and country names.
raven
  Enables logging server exceptions to a Sentry server. If installed and configured, Pootle will automatically use the raven client.
python-ldap
  Enables LDAP authentication. Be sure to check the LDAP settings.

## Tips

With a few extra steps, you can support more users and more data. Here are some tips for performance tuning on your Pootle installation.

- Ensure that Pootle runs under a proper web server.
- Be sure to use a proper database server like MySQL instead of the default SQLite. You can migrate an existing installation if you already have data you don’t want to lose.
- Install memcached and enable it in the settings file.
- Install the latest recommended version of all dependencies. Django and the Translate Toolkit might affect performance. Later versions of Pootle should also give better performance. You can upgrade to newer versions of Pootle easily.
- Ensure `LIVE_TRANSLATION` is disabled.
- Ensure `DEBUG` mode is disabled.
- Ensure that the `zip` and `unzip` commands are installed on your server. These can improve the performance during upload and download of large ZIP files.
- Ensure that you have an indexing engine installed with its Python bindings. This will improve the performance of searching in big projects. PyLucene should perform better, although it might be harder to install.
- Ensure that you have python-levenshtein installed. This will improve the performance when updating against templates.
- Increase the cache timeout for users who are not logged in.
- Increase your `PARSE_POOL_SIZE` if you have enough memory available.
- Enable `'django.contrib.sessions.backends.cached_db'`.
- Disable swap on the server. Things should be configured so that physical memory of the server is never exceeded. Swapping is bound to seriously degrade the user experience.

### Apache

For Apache, review your server settings so that you don’t support too many or too few clients. Supporting too many clients increases memory usage, and can actually reduce performance.

No specific settings can be recommended, since this depends heavily on your users, your files, and your hardware. However the default value for the `MaxClient` directive (usually 256) is almost always too high. Experiment with values between 10 and 80.

### MySQL

Using MySQL is well tested and recommended. You can migrate your current database if you already have data you don’t want to lose.

If using MySQL backend, for smaller installations it is suggested to go with MyISAM backend (which might result in smaller memory usage and better performance). If high concurrency is expected, InnoDB is suggested to avoid locking issues.

### Fast PO implementation

If you want better performance for your PO based operations, you can try to enable the fast PO implementation. This implementation will be used if `USECPO=2` is available in the operating system environment variables. Note that this is different from the web server’s environment variables.

Your PO files will have to have character encodings specified, and be perfectly valid PO files (no duplicate messages or other format errors). Be sure to test this extensively before you migrate your live server to this setup.