Ask a question

3315 questions

3767 answers


16850 members

Ask a question
0 votes
in Vehicle tracking by
Hello !

Firstly, I want to say that I ask this question because I am curious...and I think for later also, so I have no urgent needs for the moment.

I have created a Java server to support Teltonika trackers. For the moment, it seems to works well for my tests.
One tracker is connected to one single port and create one thread. (also, I don't know if creating a lot of threads is a good idea...).

However, I have read on some forums that I can't connect more than 65536 trackers (clients). For the moment, I am far of this number.

Is it true ?

Also, if "yes", is it possible to redirect a tracker on an other server, like a load balancing method ? Because we have to assign an IP and port to the tracker.

So to sum up, I am thinking about the scalability of my server and how works the other servers to take huge amount of trackers.

I am sorry to ask this type of question.

Thanks a lot for your help,

1 Answer

0 votes
Use a load balancer + multiple servers. The units will connect to a single IP address managed by the balancer, and it will distribute connections to your servers. This way is a lot easier to manage and scale.

There are services offered by AWS or GCP for this. Alternatively you can roll your own, can use HAProxy, for example.

Also, using a thread per connection does not scale that well, as each thread allocates a lot of RAM for its stack and context switching. And you are right, there is a limit to the number of simultaneous connection to a machine. This depends on the OS used.
Hello !

Thanks for your answer.

I will look at HAProxy.

So, in fact, I have to configure this software and after, I "just" have to change the destination IP and port inside the tracker ? So when I have to send an ACK to the tracker, it will pass through the load balancer (HAProxy) again.
Tracker -> HAProxy -> Server
Server -> HAProxy -> Tracker

So, HAProxy should do "all" the work without a lot of modifications to my Java server, no ?

In order to avoid threads, I have seen asynchronous functions. But it seems to be complicated to read/maintain.
And for Java, there is Project Loom with Fibers (little threads) which is being developed.
So, I don't no if there is "simples" alternatives for the moment.

Thanks for your help !
I will try to learn more about this.