MySQL Database Optimization

Default MySQL configuration might be enough for a small number of devices, but if you have a big number of devices and/or high frequency of location reporting, you might want to adjust database configuration. Optimal parameters depend on many factors, so following are just our preferences when running Traccar on DigitalOcean VPS servers with Ubuntu operating system.

Add custom configuration file:

nano /etc/mysql/mysql.conf.d/custom.cnf

Example for a server with 3GB of RAM:

innodb_buffer_pool_size = 2G
innodb_log_file_size = 512M
innodb_flush_method = O_DIRECT
innodb_flush_log_at_trx_commit = 0

Restart MySQL service and Traccar service for new parameters to take effect:

sudo systemctl stop traccar
sudo systemctl restart mysql
sudo systemctl start traccar