getappmap / appmap-js

Client libraries for AppMap
45 stars 12 forks source link

High CPU and memory usage with AppMap scanner CLI #1368

Open jansorg opened 9 months ago

jansorg commented 9 months ago

I tested https://github.com/TooTallNate/Java-WebSocket/tree/master with the JetBrains AppMap plugin (0.48.0)

Setup:

The machine had a very high memory usage for the scanner and also constantly high CPU usage (consuming 1-2 CPU threads). The usage didn't go down after waiting for about 15 minutes. AFAIK the AppMaps were already indexed and scanner in the previous session of the IDE, AFAIK. I'm not sure why the scanner is apparently working on it again...

image

kgilpin commented 5 months ago

This may be worth another look. @petecheslock do you think you could try this out and see if it reproduces?

petecheslock commented 5 months ago

sure thing!

petecheslock commented 5 months ago

@kgilpin I went and did the following steps and was able to recreate the issue where the scanner and appmap binaries had high CPU.

1) Opened the project in VSCode setup with maven and ran the tests in VS Code to generate maps - got about 200 of them. 2) Confirmed that all the maps had associated folders which appears that scanner completed running 3) Opened the same project in Intellij, and after a few seconds of startup the scanner and appmap binaries showed high CPU usage.

Screenshot 2024-01-15 at 1 16 26 PM
IntelliJ IDEA 2023.1.5 (Community Edition)
Build #IC-231.9392.1, built on July 25, 2023
Runtime version: 17.0.7+10-b829.16 aarch64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
macOS 13.6.3
GC: G1 Young Generation, G1 Old Generation
Memory: 2048M
Cores: 10
Metal Rendering is ON
Registry:
    debugger.new.tool.window.layout=true
    ide.experimental.ui=true

Non-Bundled Plugins:
    idea.plugin.protoeditor (231.9225.5)
    Docker (231.9392.1)
    org.jetbrains.kotlin (231-1.9.10-release-459-IJ8770.65)
    appland.appmap (0.54.0)

Kotlin: 231-1.9.10-release-459-IJ8770.65
Screenshot 2024-01-15 at 1 16 26 PM
kgilpin commented 5 months ago

Ok thanks very much @petecheslock - we should devote some energy to fixing this.

dividedmind commented 4 months ago

I cannot reproduce this problem as of https://github.com/TooTallNate/Java-WebSocket/commit/aa84b39396ed94867eba9daa0afc43c0a0d559aa and AppMap plugin 0.58.0 on IntelliJ IDEA 2023.3.4 (Community Edition) on Linux.

apotterri commented 2 months ago

Testing this on macOS, I see CPU usage of 30-40%, much higher than is desirable. It seems likely that this is caused by building scanner-macos-* on a Linux runner, where fsvents is not available.