Horizontal scaling best practices

Synergy Dave19 days ago

Hello,
first, thanks for the great features you introduced in recent traccar versions.

I'm planning to migrate to version 6 and I would like to use the horizontal scaling feature and I've some few questions.

  1. I used to have a basic setup with single traccar server with a public IP, and all devices are configured to send to this public IP.
    Now if I introduce a new traccar server, and configure both servers to use horizontal scaling (I'll use local ethernet interface to synchronize servers), does the 2nd server needs a public IP too and then I need to manually configure new devices to send to this 2nd public IP or I can continue using the same first public IP for all my devices?
    Or I'm totally wrong and I need to have a load balancer in front of traccar servers that uses one single public IP.

  2. Which is faster for synchronization, Redis/multicast, I've a 10Gb ethernet interfaces.

  3. is it better to have mySQL on a server by itself or have it on one of the traccar servers.

  4. if we opt for Redis for synchronization, should Redis be on a dedicated server too?

Thanks

Anton Tananaev19 days ago

Why do you want to use horizontal scaling?

Synergy Dave19 days ago

I'm running more than 10k devices on a single traccar server and I want to be able to connect more devices.

Anton Tananaev19 days ago
  1. If the reason is to support more devices, you should obviously spread devices by servers. Otherwise what's the point?
  2. Multicast is definitely more efficient, but it's not always available. Some cloud providers don't allow it.
  3. You would probably need a database cluster as well. Database is actually the bottleneck, so that's the first thing you should scale because scaling Traccar itself.
  4. Doesn't matter.
Synergy Dave19 days ago

Thank you,
as for point 1, so to spread devices by servers, I'll have to buy more public IP addresses for each server. No way to use HAProxy or nginx to load balance traffic?
If I spread devices on multiple servers, what about commands sent via API to devices (stop engine, etc), do I need to maintain a session for every server and send commands to server connected to the device? Do I need to maintain a map: deviceID --> trccar-serverIP?

Anton Tananaev19 days ago

I never said that you need more public IP addresses. You can and probably should use a load balancer.

For APIs you should probably use load balancer, but it doesn't matter to what server you're connected. All APIs should work fine.

Synergy Dave19 days ago

That’s great.
Any tested/recommanded load balancer?

Anton Tananaev19 days ago

Any load balancer should work. That's not something specific to Traccar.

Synergy Dave18 days ago

Just checked with my provider, they allow 20 packets/second for muticast, I think it’s a low value for synchronization of more than 10k devices sending at 10s frequency.

Hello, I am delving into the topic of horizontal scaling of Traccar, I have some doubts about it (I apologize in advance if I ask stupid questions due to my ignorance):

  1. Can you have multiple Traccar servers pointing to the same MySQL database that is located on a separate server?

  2. Can each Traccar server have its own IP address so that for example 10k devices point to the IP of Traccar server 1 and another 10k devices point to Traccar server 2?

  3. When querying the APIs, can I query the APIs of any of the Traccar servers and in theory would they all work since the data comes from a single database server?

  4. Do I necessarily need to have the MySQL database in a database cluster? o This is not a mandatory requirement to scale out Traccar.

In advance, thank you very much to those who help clear my doubts

Anton Tananaev14 days ago
  1. Yes.
  2. Yes.
  3. Already answered above. Please carefully read the thread.
  4. Not required.

Thanks you Anton, now i have clear