High availability and load balancing using the Traccar Server

jcorreajr7 years ago

Hello!
I would like to configure infrastructure of high availability and load balancing in the use of Traccar, mainly in the device communication part.

Reading this post that divides Server Architecture into two parts: (device Communication and Embedded web server) I created a test environment according to the image: traccarHA

In this environment, the positioning data is correctly included in the database. By connecting to the WebServer, the reports display the correct information, but the device is not updated automatically on the map. The 'Last Update' field is also not updated.

Is there any way to separate device communication from the Embedded web server without any detrimental effects on the use of Traccar?

Thank you!!

Anton Tananaev7 years ago

It is possible, but it would require significant modifications to the Traccar code. Two problems you have to solve:

  1. Internal cache
  2. Sending commands

If you don't care about the second one, you can probably use distributed cache like Redis to solve first problem.

jcorreajr7 years ago

To solve the second problem, (Sending commands) can I use an architecture of two Webservers together with device communication? (Picture below)

dualWebServer

I do not think so, since a user logged on to server-1 may try to send the command to a device that has a connection established on Server-2, or vice versa.

Has anyone ever been able to deploy Traccar on multi-server, sending commands?

Anton Tananaev7 years ago

I think the way to make it work is to assign devices and corresponding users by server and have a sophisticated load balancer that would know which server handles which device.

Basically it would be a solution for scaling of the system, not for reliability because there will be a single server responsible for particular device/user.

If you want to implement redundancy, you would have to implement a way for server to talk to each other to know which one has an active connection with a particular device.