This page provides information on configuring Traccar and the operating system to work with a large number of devices and users.
In addition to server optimization, we recommend regular cleanup of old location history and logs. Check the clear history page for instructions.
You can check the file descriptor limit for the Traccar service using:
systemctl show traccar --property=LimitNOFILE
To increase it, run sudo systemctl edit traccar and add:
[Service]
LimitNOFILE=50000
Use a number higher than your device count because the server also needs file descriptors for files and other connections. Reconnecting devices can temporarily use additional connections.
Restart the service to apply the change:
sudo systemctl restart traccar
Large installations may also reach system-wide file-handle limits or the Java process's memory-mapping limit. Check the server and system logs to identify which limit is being reached.
If needed, increase the corresponding setting in /etc/sysctl.conf:
fs.file-max = 250000
vm.max_map_count = 250000
fs.file-max controls the total number of file handles available across the system. vm.max_map_count controls the number of memory mappings allowed per process. These are example values; choose values above your current limits that suit your workload.
Apply the changes with:
sudo sysctl -p
For running multiple Traccar instances, see Horizontal Scaling.
If a device loses connectivity without closing its TCP connection, the server can be left with a stale connection that consumes resources. The operating system may not detect this promptly.
To avoid this, set server.timeout or a protocol-specific setting such as teltonika.timeout in the configuration file. Set the value in seconds to longer than your device's normal reporting interval, allowing for sleep periods and network delays.
Traccar uses a Java virtual machine, which limits the amount of memory it can use.
You can change the Java heap size by adding these options to the service command:
On Linux, the service configuration is located at /etc/systemd/system/traccar.service. Add the option before -jar, keeping any existing options. For example:
ExecStart=/opt/traccar/jre/bin/java -XX:+ExitOnOutOfMemoryError -Xmx1G -jar tracker-server.jar conf/traccar.xml
This sets the maximum heap size to 1 GB. After editing the service file, reload it and restart Traccar:
sudo systemctl daemon-reload
sudo systemctl restart traccar
By default, Traccar uses an embedded H2 database to simplify installation. For production use, we recommend a fully-featured database engine. For large installations, we recommend PostgreSQL, optionally with the TimescaleDB extension. Traccar also supports MySQL or MariaDB and Microsoft SQL Server.
Make sure the database is configured for your data volume and traffic. Default cache sizes and other settings might not be suitable for your use case.