Traccar CPU performance

memesaregood 3 years ago

Hello,

We have noticed that our Traccar uses a single core for computing, so all our other cores have no load. Please let me know if there's a setting to allow multi-core computing, and if there isn't, please say what's better for Traccar:
A. The CPU that has small amount of cores but higher frequency - "числодробилки";
B. The CPU that has more cores, but lower frequency.

If that is B, how do we tell Java to use multiple cores?

Thank you.

Anton Tananaev 3 years ago

Traccar should be using multiple cores automatically when needed.

memesaregood 3 years ago

In our situation, that does not appear to be the case. One core is under a flat 100% load. How do we troubleshoot?

Anton Tananaev 3 years ago

It depends on the place where it happens. I was talking in general. You can probably check the process using some Java profiling tools to see what's using the CPU time.

memesaregood 3 years ago

Can you tell us if there will be a performance increase, if we force Java to use multiple cores through -XX:ActiveProcessorCount=x?

Anton Tananaev 3 years ago

I doubt it.

memesaregood 3 years ago

It appears that a nioEventLoopGroup-3-5 thread is taking longer than usual. Do you think it will be possible to switch to EpollEventLoop for the sake of better performance?
VisualVM CPU Sampling

Anton Tananaev 3 years ago

It's probably one of the Netty threads, so it doesn't really tell us much because most of the processing is done in those threads.

memesaregood 3 years ago

Okay. How do we diagnose the issue further? What's next?

Anton Tananaev 3 years ago

You need to profile specific classes/methods that take the CPU time. Maybe it's related to computed attributes?

memesaregood 3 years ago

May you suggest a tool to do so?

memesaregood 3 years ago

We ended up using JProfiler. It appears that it is indeed related to computed attributes, as the createScript function seems to be taking its time.
Screenshot
Question is, why doesn't Java distribute the load to other cores, and if there's actually a reason behind this, is it still possible to compute multiple attributes in parallel, making other cores do work too?

Anton Tananaev 3 years ago

Not sure. I would think that it's happening synchronously on whatever Netty thread it is running on.

memesaregood 3 years ago

Could you please think about rerouting the load to cores equally then? The current implementation is not ideal, with all respect.

Track-trace 2 years ago

I wonder how this relates to horizontal scaling while it seems the server is not able in this case to use all cpu cores on one server?