FAQ Increase Performance

From Dolibarr ERP CRM Wiki
(Redirected from Increase Performance)
Jump to navigation Jump to search

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.


Recommanded solutions

From v14, you will find into menu Home - Admin tools - Performances, a page with advice on your setup to get the best performance of your application. Start with that if your version is v14+.

You can then complete with the following recommendations...


Use the latest PHP version

Efficiency: ***

Principle: Each new version PHP makes application faster than the previous one. So, if you can, just upgrade.

Activate HTTP/2

Efficiency: *

Principle: HTTP/2 protocol is know to be faster than HTTP/1.1. So if your OS and webserver is compatible, just enable it.

Disable xdebug

Efficiency: **

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

Efficiency: *** (if you use a Windows server) or * (on linux server)

Principle: Installing a memcached server and the Module MemCached. Note that on Linux server, the i/o are already correctly cached by the OS so this solution is efficient only on OS and filesystem with bad performances like Windows)

PHP OPCODE cache

Efficiency: *** (if php < 7.0, useless for PHP 7.0+)

Principe: If you use an old PHP version, install an apache/php module that save PHP pages compilation result into a cache. Each page access will be faster. Xcache is the recommended solution. Note that caching occurs here on a different level than Module MemCached, so gains are cumulative !

HTTP cache of static pages

Efficiency: **

Principle: You can setup apache to activate explicit cache of static resources by adding following directives:

# Cache for static resources (Enable expiration and set it to A2592000 = 1 month)
ExpiresActive On
ExpiresByType image/x-icon A2592000
ExpiresByType image/gif A2592000
ExpiresByType image/png A2592000
ExpiresByType image/jpeg A2592000
ExpiresByType text/css A2592000
ExpiresByType text/javascript A2592000
ExpiresByType application/x-javascript A2592000
ExpiresByType application/javascript A2592000

Again, gain is cumulative with other previous caches.

Warning.png After adding this, you must reload web server setup but also clear local cache browser to force browser to ask full file again and get new header.

Enable compression of resources by Apache

Efficiency: *** (on low bandwith network)

Principle: You can setup apache to activate compression of returned resources by adding following directives:

# Compress returned resources of type php pages, text file export, css and javascript
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript application/javascript application/x-javascript

Warning.png After adding this, you must reload web server setup but also clear local cache browser to force browser to ask full file again and get new header.

Use mysqli driver instead of mysql

Efficiency: ** (for very old PHP version)

Principle: If you use a mysql database, check into your Dolibarr config file htdocs/conf/conf.php that you have the line

$dolibarr_main_db_type='mysqli';

If value is mysql, change it into mysqli that provide better performances (gain is 30ms for each page call).

Search on beginning of field

Efficiency: * to *****

Principle: When you have a high number of products or third parties, you must disable the "autocomplete" search or lists will take a long time to appear. First thing to do is to go into setup of module Product and Thirdparty and change the option "Wait you have pressed n keys before loading list of product/thirdparties/contact be loading combo list". And select n = 1 or 2. Also, you must know that searching a ref 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.

Disabling combo ajax

Efficiency: ***

If you have a large number of third parties, contacts or products (> 5000), you can deactivate the product preloading feature to only load the list after clicking on 1, 2 or 3 characters. This is done from the configuration page of the Third Party or Product module.

Use a recent web browser

Efficiency: ***

Principle: More and more features used Ajax or javascript technologies to offer a modern look and feel. Such technologies are an important part of time taken to show a page and are best processed with a recent web browser. Gap between a version and the next one are sometimes very important, so think to use an optimized web browser and always the last stable version (Firefox, Chrome, Safari or Opera). Avoid IE or other exotic web browsers.

Update your database statistics

Efficiency: **

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.

Other solutions

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 !

Disable "on fly" PDF generation

Efficiency: **

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.

Disable Canvas feature

Efficiency: *

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.