Dealy 0 second with Base H2 vs Dealy 2 minutes with base mysql

gmlmaino3 years ago

Hi Anton, first of all thanks for developing and sharing this excellent Tool, I'll ask you a question, I'm developing with your tool and I find an issue that I don't know how to solve it, I have a vps server, with 4 g ram, 2 cpu, and 80g disk, and install traccar there, with a mysql database on the same ip.
The issue is that if I make it work with the h2 database, basic installation, when I execute or generate events, for example I open the door, contact, or sos, the response on the server, or better said on the web, is with a delay of 1 second, it is spectacular, but when I do it with the mysql database, I have a delay of almost 2 minutes to see the same events generated, the gps configuration is always the same in the two test cases, and Here is the question, what is it that makes the mysql database take time to register the data, and obviously shows it on the web 2 minutes later. the issue is that the registration time in the mysql database is correct, it saves it with the time it was, only that it shows it later. you know where I have to aim to improve this solution.
I add, they are late, but all the events arrive, they do not miss any.
Thank you.

Anton Tananaev3 years ago

Event generation happens before storing data in the database, so database should not cause any delays. There must be some other explanation.

Also, the delay should be milliseconds, not seconds. I suspect there are some network issues or device issues.

gmlmaino3 years ago

Sure, I thought so, something in the gps, but as it explains that in h2 it is instantaneous, and mysql not, it is the same gps with the same configuration, also, to see if it was that, use the python tool to send events, and in h2 it is perfect, and in mysql it takes the two minutes that I was telling you, then of course as this is a loop, once it is working constantly, but in reality you are seeing back data, which together seem to be instantaneous.

Anton Tananaev3 years ago

The only thing I can recommend is debug the code to figure out where the delay comes from. From what I know, the type of database should be irrelevant.

gmlmaino3 years ago

In the log I see all the data, there are no losses from what I can see, it is only that it registers them with a delay, and it is not the only installation, I already made 4 cleanings with different IPs, in digital ocean, and I always get the same Result, with the python test, I think I should discard the gps, and focus on the base configuration right?

Anton Tananaev3 years ago

You need to find the root cause. In my opinion, the database shouldn't cause this issue.

gmlmaino3 years ago
2021-10-21 21:19:47  WARN: Geocoding failed - Connection timed out (Connection timed out) - ConnectException (...)
2021-10-21 21:19:47  INFO: [e2eff1ce] id: 864895034392868, time: 2021-10-21 21:17:34, lat: -38.01738, lon: -57.52815, speed: 0.0, course: 0.0
2021-10-21 21:19:47  INFO: [e2eff1ce: gps103 < 181.117.216.28] HEX: 3836343839353033343339323836383b
2021-10-21 21:19:47  INFO: [e2eff1ce: gps103 > 181.117.216.28] HEX: 4f4e
2021-10-21 21:19:56  INFO: [e2eff1ce: gps103 < 181.117.216.28] HEX: 696d65693a3836343839353033343339323836382c747261636b65722c3231313032313138313935342c2c462c3231313935342e30302c412c333830312e30343031382c532c30353733312e36393035342c572c302e3035352c303b
2021-10-21 21:19:57  WARN: Geocoding failed - Connection timed out (Connection timed out) - ConnectException (...)
2021-10-21 21:19:57  INFO: [e2eff1ce] id: 864895034392868, time: 2021-10-21 21:17:44, lat: -38.01738, lon: -57.52815, speed: 0.1, course: 0.0
2021-10-21 21:20:06  INFO: [e2eff1ce: gps103 < 181.117.216.28] HEX: 696d65693a3836343839353033343339323836382c747261636b65722c3231313032313138323030342c2c462c3231323030342e30302c412c333830312e30343030362c532c30353733312e36393036372c572c302e3133372c303b
2021-10-21 21:20:07  WARN: Geocoding failed - Connection timed out (Connection timed out) - ConnectException (...)
2021-10-21 21:20:07  INFO: [e2eff1ce] id: 864895034392868, time: 2021-10-21 21:17:54, lat: -38.01738, lon: -57.52814, speed: 0.0, course: 0.0

I think it is the geocoding function that I have activated, but it is not configured correctly, could that be the cause of the delay?

Anton Tananaev3 years ago

That could definitely cause a delay. You said the configuration was the same. Was that a false statement?

gmlmaino3 years ago

what I told you is the same configuration of the gps unit, do not change anything in the gps configuration, what is wrong is that I have configured on the server to do geocoding, but that is not set correctly.

Anton Tananaev3 years ago

Even if that specific sentence was about device configuration, the rest of the comments heavily implied that the only difference was the database.

Obviously calling external service to get address information will add a delay.

gmlmaino3 years ago

There I deactivated the geocoding function, and that was it, now show the events, with less than 1 second, thanks.