
Introduction: Why Performance Matters in Dolibarr
Dolibarr ERP/CRM is a widely respected open-source solution for small and medium-sized enterprises, offering flexibility, modularity, and affordability. However, like any web-based system, performance issues can arise if it’s not configured or maintained properly. A sluggish Dolibarr instance not only hampers productivity but can lead to user frustration, data integrity issues, and even business losses.
Optimizing Dolibarr isn't just about server horsepower; it involves configuring the application, tuning the underlying stack, and setting up best practices for data management and module usage.
In this detailed guide, we’ll cover actionable strategies to make your Dolibarr installation faster, more reliable, and ready for growth.
Understanding Performance Bottlenecks
Before applying optimizations, it's crucial to understand where the bottlenecks might appear:
-
Server resource limitations: CPU, RAM, or disk IO problems.
-
Database inefficiencies: Poor indexing, slow queries.
-
Web server configuration: Apache or Nginx misconfigurations.
-
PHP tuning: Mismanaged execution limits or caching absence.
-
Application misuse: Activating too many modules, using heavy reports without filters.
-
Network issues: Slow upload/download speed, poor server location.
Identifying the source of the slowdown ensures you focus your efforts where they matter most.
Server Environment Optimization
1. Choosing the Right Hosting
If you are self-hosting Dolibarr, make sure you choose a reliable VPS or cloud server instead of cheap shared hosting. For production environments, a basic recommended server specification would be:
-
2 vCPUs
-
4 GB RAM minimum
-
SSD storage
For growing businesses, scale resources as you expand.
2. Operating System Tweaks
Use lightweight distributions like Ubuntu Server or Debian without unnecessary graphical interfaces to conserve system resources.
Keep your system packages and security patches up-to-date:
sudo apt update && sudo apt upgrade -y
Enable a swap file if RAM is limited:
sudo fallocate -l 2G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
3. Web Server Configuration (Apache or Nginx)
Apache:
-
Enable
mod_deflate
andmod_expires
for compression and caching. -
Use the event MPM (Multi-Processing Module) instead of prefork.
a2enmod deflate
Nginx:
-
Configure gzip compression.
-
Set proper client-side caching for static assets.
Example Nginx settings:
gzip on;
gzip_types text/plain application/json application/javascript text/css;
client_max_body_size 20M;
PHP Tuning
PHP is the backbone of Dolibarr; misconfigurations here can drastically affect performance.
-
Increase memory limits:
memory_limit = 512M
-
Adjust execution times:
max_execution_time = 300
post_max_size = 100M
upload_max_filesize = 100M
-
Install and configure OPcache:
sudo apt install php-opcache
Enable OPcache settings in your php.ini:
opcache.enable=1
opcache.memory_consumption=128
opcache.interned_strings_buffer=8
opcache.max_accelerated_files=10000
OPcache significantly reduces PHP execution time by caching precompiled script bytecode.
Database Optimization
1. MySQL or MariaDB Configuration
Optimize your database settings in my.cnf
or mariadb.cnf
:
innodb_buffer_pool_size = 1G
innodb_log_file_size = 256M
query_cache_type = 1
query_cache_size = 64M
-
innodb_buffer_pool_size should ideally be 60-70% of your total RAM.
-
Enable slow query logging to identify problematic queries.
slow_query_log = 1
slow_query_log_file = /var/log/mysql/slow.log
long_query_time = 2
2. Database Indexing
Ensure that your Dolibarr tables are properly indexed. Indexes improve search performance dramatically. When in doubt, inspect heavy queries and add indexes on columns used frequently in WHERE, ORDER BY, or JOIN clauses.
3. Regular Maintenance
Perform routine database maintenance:
-
Optimize tables:
OPTIMIZE TABLE llx_yourtablename;
-
Clean up logs and old data periodically.
-
Backup before major upgrades or changes.
Application-Level Optimization
1. Smart Module Management
Dolibarr allows activating many modules, but activating unnecessary modules consumes resources. Only activate the modules you truly need. Deactivate or even uninstall unused modules to reduce overhead.
2. Customizing Dashboards
Avoid overloading your home dashboard with too many widgets, charts, or lists. Every widget results in multiple database queries during page load.
Use simplified dashboards focused on what users need most.
3. Paginate and Filter Lists
Whenever you list large amounts of data (customers, invoices, products), enable pagination. Set a reasonable number of items per page (e.g., 25 or 50) instead of listing hundreds of records at once.
Always apply filters when running reports or exporting data.
4. File Management
Store documents (invoices, contracts) externally if possible, using linked cloud storage (AWS S3, Google Cloud) instead of your main server disk.
Caching and Frontend Optimization
1. Enable Browser Caching
Make use of .htaccess
rules or Nginx settings to tell browsers to cache static files:
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access plus 1 year"
ExpiresByType image/jpeg "access plus 1 year"
ExpiresByType image/gif "access plus 1 year"
ExpiresByType image/png "access plus 1 year"
ExpiresByType text/css "access plus 1 month"
ExpiresByType application/pdf "access plus 1 month"
ExpiresByType application/javascript "access plus 1 month"
</IfModule>
2. Minify Assets
Dolibarr’s core doesn't auto-minify JavaScript and CSS. If you're comfortable, manually minify custom assets or use third-party tools like Cloudflare for automatic optimization.
3. Use a CDN
Deliver static files (images, CSS, JS) through a CDN to reduce server load and latency, especially for international users.
Security vs Performance
Performance shouldn't come at the cost of security. Apply security best practices:
-
Always use HTTPS.
-
Set strict file permissions.
-
Keep Dolibarr and plugins updated.
-
Monitor access logs for suspicious activities.
Using a Web Application Firewall (WAF) can slightly add overhead but is worth it for critical deployments.
Monitoring and Benchmarking
Install basic monitoring tools to keep an eye on your server health:
-
htop: for real-time CPU, memory, and process monitoring.
-
iotop: for disk IO tracking.
-
MySQLTuner: for database health checks.
Benchmark periodically:
-
Page load time
-
Server response time
-
Database query times
This way, you spot problems early and keep performance at an optimal level.
Scaling Strategies for Growing Businesses
As your business grows, your Dolibarr instance must scale too:
-
Vertical scaling: Upgrade your VPS/server resources (CPU, RAM, SSD).
-
Horizontal scaling: Split services (e.g., separate web server and database server).
-
Load balancing: Distribute traffic between multiple servers.
-
Database replication: Use master-slave setups to distribute read queries.
For very large deployments, consulting a DevOps professional is advisable.
Conclusion
Optimizing Dolibarr for better performance is a strategic investment in your business's efficiency. From server configurations and PHP tuning to database management and smart application usage, there are multiple layers where improvements can make a significant difference.
Start by identifying bottlenecks, apply the fundamental optimizations outlined here, and continuously monitor your system. A well-optimized Dolibarr instance not only speeds up user operations but ensures scalability and reliability as your business evolves.
Remember: performance tuning is an ongoing process, not a one-time task. The effort you invest today will pay off every single day you use Dolibarr to run your business.