Setting up Horizontal scaling in traccar

Enirh9 months ago

Hi,

I am migrating from 4.6 to the lastest version of traccar after a long time. I went through the horizontal scaling documentation provided and have a few questions while setting it up

  1. Do we have to put a load balancer in front of the traccar nodes to route the traffic to the servers? If so how are the sessions maintained? Or do we have to point a set of devices to each server in the multicast group sharing a common db? Like 10k devices to server1, next 10k to server 2 etc and since they are having a shared db and copied cache, and the system can be considered as one single instance?

  2. If a load balancer is used, there's the option to forward the traffic to a specific backend TCP port. Since multiple ports are being listened on, how can this be achieved? I evaluated 2 vps and found the load balancer behaving in the same manner. It's one single port that the traffic can be forwarded to based on some routing algorithms. These are managed load balancer.

  3. Will it make more sense to host my own load balancer in nginx? I was under the idea that the load balancer would route the traffic to any of these servers and which server the device connects to. That way a group of multiple smaller servers can be used to handle a much larger traffic. it would get sticky would that. Is that understanding correct?

  4. For the APIs any one of these servers can be used to serve http requests. Since the server has access to the shared database it can pull out reports for all devices. Is this understanding correct?

  5. For device commands the command would be broadcasted to all the nodes and whichever has the device connected will act upon it. Is this understanding correct?

I am new to multicast, so answers to these would help understand the entire system with more clarity. Thanks in advance.

Anton Tananaev9 months ago
  1. Either option works, but load balancer is a more universal solution, of course.
  2. You have to forward the external ports to the same internal device ports.
  3. More sense than what?
  4. Yes.
  5. Yes.
Enirh9 months ago

1- That solves the operational overhead of maintaining a device to ip mapping. So better to go ahead with that.

3- More sense than using the managed one. I can't find the option of forwarding more than one port in the services I have evaluated.

Anton Tananaev9 months ago

You definitely need to forward more than one port. You need one for each protocol that you use and then one for the web app also. I'm pretty sure nginx and most other popular solutions support it.