FAQ Increase Performance
Dolibarr is a web application designed to have best response time. A lot of technologies are used but some of them are not enabled by default as they need some specific skills to use them. This is a list of all possible things you can do to increase Dolibarr speed.
- 1 Recommanded solutions
- 1.1 Use the latest PHP version
- 1.2 Activate HTTP/2
- 1.3 Disable xdebug
- 1.4 Applicative cache using MemCached
- 1.5 PHP OPCODE cache
- 1.6 HTTP cache of static pages
- 1.7 Enable compression of resources by Apache
- 1.8 Use mysqli driver instead of mysql
- 1.9 Search on beginning of field
- 1.10 Disable ajax combo
- 1.11 Use a recent web browser
- 1.12 Update your database statistics
- 2 Other solutions
Use the latest PHP version
Principle: Each new version PHP makes application faster than the previous one. So, if you can, just upgrade.
Principle: HTTP/2 protocol is know to be faster than HTTP/1.1. So if your OS and webserver is comaptible, just enable it.
Principle: If php module xdebug is active, you should disable it. This module is a PHP feature to help developpers but it's useless for a production usage and slow down all PHP softwares. To know if this module is active, go on page Home-Setup-System info-PHP and do a search on xdebug. If you don't find anything, module is not active. If you find an occurence, module is active and can be disabled.. Enabling/Disabling such a module depends on your PHP system and OS. The most common way is to comment a line into you php.ini and restart web server.
Applicative cache using MemCached
Principle: Installing a memcached server and the Module MemCached.
PHP OPCODE cache
Principe: Install an apache/php module that save PHP pages compilation result into a cache. Each page access will be then faster. For this, you can install any PHP accelarator. xcache is one of the recommanded solution. Note that caching occurs here on a different level than Module MemCached, so gains are cumulative !
HTTP cache of static pages
Principle: You can setup apache to activate explicit cache of static resources by adding following directives:
Again, gain is cumulative with other previous caches.
Enable compression of resources by Apache
Principle: You can setup apache to activate compression of returned resources by adding following directives:
Use mysqli driver instead of mysql
Principle: If you use a mysql database, check into your Dolibarr config file htdocs/conf/conf.php that you have the line
If value is mysql, change it into mysqli that provide better performances (gain is 30ms for each page call).
Search on beginning of field
Principle: If you activated, into Product module, the "autocomplete" search and list take a long time before to appear after typing a new character, this probably means you have an important number of product. Search is done everywhere in the text, so database index on field can't be used. By adding the constant PRODUCT_DONOTSEARCH_ANYWHERE to 1 into Home-Setup-Other, you limit the search to the beginning of strings making possible for database to use index and you should get an immediate response. You also have the constant COMPANY_DONOTSEARCH_ANYWHERE for searches of third parties.
Disable ajax combo
If you have a large amount of third-party or product (> 5000), you can disable the autocomplete feature on third parties list by setting constant MAIN_DISABLE_AJAX_COMBOX to 1 into Home-Setup-Other (with Dolibarr v3.6.0+).
Use a recent web browser
Update your database statistics
Principle: If you use a large database (more than 100 000 records), check that statistics of data are up to date. This need an admin access to database server and some database administration knowledge. Check your database manual about "update statistics" for this.
All solutions here are categorized into an "Other solutions" because they are not recommended. All of them may needs advanced technical knowledge, may not be stable, not supported or may break some features... but they exists, so use them only if you know what you do !
Pre-requisites: Using an Apache web server
Principle: Add into Home-Setup-Other the constant MAIN_OPTIMIZE_SPEED. If value of constant has bit 1 set, Dolibarr will use shared memory to cache translation of language files. This means that only one language can be used (the one defined by first user that log after the Apache server reboot). Also shared memory may be not stable with some OS (like Windows). Use instead of this option, the Module MemCached that has no limits, is more efficient and completely reliable.
Disable "on fly" PDF generation
You can option MAIN_DISABLE_PDF_AUTOUPDATE into Home - Setup - Other.
This will disable generation of a new PDF each time you make a change on element. PDF generation will happens only when you click on "Generate" button.
Compression of resources by Dolibarr
Principle: Add into Home-Setup-Other the constant MAIN_OPTIMIZE_SPEED. If value of constant has bit 2 defined (Example: MAIN_OPTIMIZE_SPEED=4), Dolibarr will return pages compressed into GZ (and if browser support it). This consume more CPU on server but reduce transfer time. Use it with slow connexion. Prefer to use compression by Apache than this trip. Do not use both methods.
Disable Canvas feature
Principle: Add into Home-Setup-Other the constant MAIN_DISABLE_CANVAS to value 1. This will disable canvas features that might be used by external modules and save one database request each time you go on page to show an object. However, if an external module used canvas, this will break this module. If you did not install and do not plan to install a complementary external modules, using this setup is safe.
Note: To enable all optimization using MAIN_OPTIMIZE_SPEED, you must enable all bits (Example: MAIN_OPTIMIZE_SPEED=7 so 1+2+4 contains bit 0, 1 and 2).