cmr-exchange / dev-env-manager

An Alternate Development Environment Manager for the CMR
Apache License 2.0
0 stars 1 forks source link

High CPU Usage #2

Closed oubiwann closed 6 years ago

oubiwann commented 6 years ago

With the latest changes to the code, (run) now induces very high CPU load. Need to find out why, and then fix that.

To duplicate:

  1. Start REPL: lein repl
  2. Start the system: (run) -- ~one CPU core will jump a little, due to the new service starting up, and then it will settle down.
  3. Reload the system: (reload) -- all CPU cores will jump, and then 1-2 will stay maxed at 100%; subsequent, repeated (reload)s will cause all CPU cores to peg out at 100%.

Depends on #3.

oubiwann commented 6 years ago

With the new JMX instrumentation in place, I used VisualVM to look at the service JVM started by (run). Actually running the service doesn't seem to be an issue, rather upon calling (stop) is where it runs into issues:

image

In particular, (stop) was called just after 2:17, seen easily in the CPU and Heap graphs.

oubiwann commented 6 years ago

Working on another task (that will allow services to be enabled/disabled in configuration), I've further narrowed this down: the CPU spike happens specifically in the ProcessRunner component's stop method; most likely in the process/terminate! call ...

oubiwann commented 6 years ago

Fantastic! In the latest change to use the messaging component (see 0b9f5c2a896d4cf01b6d83aa18617450abdfb336), this bug has gone away :-)