MySQL Optimization or Recommended Configuration

jaimzj8 years ago

Dear Anton,

I have some queries, on 3.2 Server. maybe even for 3.3 it applies.

  1. What is the best configuration settings for MYSQL Server to be used with Traccar to ensure minimal memory usage.

  2. When the number of devices run into 1000's specially, the memory usage by MSYQL Increases. Hence I was wondering if there are some specific things to consider for MYSQL Db users.

Anton Tananaev8 years ago

Are you using default queries or custom ones? You need to make sure tables have all relevant indexes to reduce memory usage and speed up queries.

jaimzj8 years ago

Default queries.

relevant indexes anything specific to do? As I haven't changed the default db nor queries/config in anyway except add some additional columns in device table.

Anton Tananaev8 years ago

If you think there are some problems with performance or memory usage, I would recommend to investigate query execution plans and then see if any new indexes need to be created.

jaimzj8 years ago

Dear Anton,

I did that here is the outcome/result as per me overall I did not see much changes to be done in terms of indexes etc. however I followed the steps below.

  1. The server / traccar 3.2 been running well for months now with gradually increasing number of devices in multiples of 100.
  2. Lately the Memory/RAM usage is high.
  3. If I restart the server it starts from low RAM Usage and over a period of 13 hours the usage increases to 85% where as it starts of at 10 to 15% after restart for hours on it remains same.

I killed mysql - Memory usage reduces few %
I killed apache and tomcat - Memory usage reduces few %
I killed traccar - Memory usage reduces yet few %

However overall still remains above 75%

I reboot the server, it goes back to Point 3.

Any advice if its something to do with traccar server or otherwise?

I am planning to upgrade the memory either way, yet thought would share this with you for your inputs/suggestiosn just incase, you might know of why this is happening.

Anton Tananaev8 years ago

Why do you need Apache and Tomcat? Are you running something else on the same server?

If you are concerned about Traccar memory usage, you can try to limit it in the wrapper config. Probably Java doesn't do garbage collection because you have enough resources.

jaimzj8 years ago

Apache and Tomcat is because, I am having my own WebApp, and default webapp is disabeld.

I will try to limit memory usage of traccar in wrapper config and let you know, thanks for the input. Let me see what happens with it :)

jaimzj8 years ago

Tried uncommenting `wrapper.java.maxmemory=64'
No luck yet. I am kind of confused about this.

Anton Tananaev8 years ago
jaimzj8 years ago

Dear Anton,

It did help, Based on your earlier inputs and assistance, and link shared. I was able to make further changes in the value/set in wrapper.

For now, for the past 5+ hours, The memory usage has reduced by 50%. I will monitor it for a day more specially during peak of transactions.

jaimzj8 years ago

For total of 12 hours it worked fine, however since then I have been constantly having the need to restart the traccar service. or the Server Itself.

as restarting traccar service helps a bit, and restarting whole server reduces memory usage pretty well and gives another 8 to 12 hours before it reaches the maximum usage.

I am attaching a screenshot below, of htop command on ubuntu filtered by command with tree view. Would be thankful if you can have a look at it and recommend me a way forward. I am using openjdk/java.

and

Anton Tananaev8 years ago

It looks like it's using only 2% of the memory. Why do you think there is a problem?

jaimzj8 years ago

True, It looks like it's using only 2%, However let me share the 'top' commands output as well below.

The problem right now is that, its using 34% of actual memory, and within 12 to 18 hours it will reach 90%+ of usage. Right now its increasing gradually...

Anton Tananaev8 years ago

It still shows 2%. Can I see a screenshot with 90%?

jaimzj8 years ago

Its at 87% now. Sharing the pattern graph (Which shows the timeline of increase as well) plus screenshot of htop and top command.