Why would you use nginx on a separate server when having only one traccar server? Nginx is very light weight.
Even though it might be a good idear when you would use nginx as load balancer for two traccar servers. Actually i would be interested to know your config for such a setup.
Logicly i am not an expert but would suggest tuning with https://www.traccar.org/optimization/
Also it would depend on what cpu you use, what storage (nvme ssd) and internet connection. I think it should be thousands devices that could be connected to your server. And it would also depend on the update frequency that you set for the devices. There are many factors, like for instance how much device history you will store.
Nginx is to control my websocket traffic.
Optimizations are already done as per the link.
We have 9 months of history data, Update frequency is 10-20 sec.
Can you guide when should i think to implement scaling
By web do you mean Traccar backend? You shouldn't put it separately from the database. That actually makes it less efficient because of the network latency.
By web I mean traccar web.
Not sure why you feel so that db on separate server will make it less efficient…. When we talk of horizontal scaling at that time also db is going to be in another server when there are more then 1 server…..
By web I mean traccar web.
Then where is your Traccar backend?
Not sure why you feel ...
I don't feel it. I know it based on the performance testing. Because of the nature of the system, Traccar does a lot of frequent small writes to the database. This is not a typical load for a database. Having database on a separate server makes the DB connection much slower than local, which reduces your throughput.
But in horizontal scaling the db is also on a separate server for the server B…. How is that being managed….
Horizontal scaling is needed not for efficiency, but for scale or redundancy. It's almost always less efficient than a single instance.
Your breakdown by servers doesn't really make much sense to me because the database and communication with the database is the real bottleneck. Web app and nginx load will be negligible compared to the database load.
Ok.. I understand… what is the device number when we should look at horizontal scaling….. with
32 GB RAM
4 TB Storage
9 months history storage
Update frequency 20-30 sec
Maybe around 10k devices, but hard to tell for sure.
Isn’t that low…. Is this based on number of connections a server can handle or limited because of storage???
I base it on the fact that the database write limit is about 5k locations per second. That's basically the absolute limit. You have to reserve some capacity for reading from the database. And then you want to buffer some for other things like uneven load etc.
But again, you should really load test it instead of these guesses.
In this case instead of scaling web, can’t we scale the DB… I mean if I create a read replica of db and send the read statements to the read replica and keep the insert / edit and delete to primary ??
Probably that's the right idea. Let us know how it goes if you try it.
Thanks for the affirmation. I plan to deploy a second server with traccar web and mysql (read replica of primary).
Will traccar connect to the read replica (as it will be read only db)....
my db, web and ngnix are 3 different server.
db
mysql
32 GB RAM
4 TB Storage
web
ubuntu 22
32 GB RAM
200 GB Storage
nginx
ubuntu 22
16 GB RAM
100 GB storage
how many devices can i expect before i approach to horizontal scaling