Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CELEBORN-1092] Introduce JVM monitoring in Celeborn Worker using JVMQuake #2061

Closed
wants to merge 1 commit into from

Conversation

SteNicholas
Copy link
Member

What changes were proposed in this pull request?

Introduce JVM monitoring in Celeborn Worker using JVMQuake to enable early detection of memory management issues and facilitate fast failure.

Why are the changes needed?

When facing out-of-control memory management in Celeborn Worker we typically use JVMkill as a remedy by killing the process and generating a heap dump for post-analysis. However, even with jvmkill protection, we may still encounter issues caused by JVM running out of memory, such as repeated execution of Full GC without performing any useful work during the pause time. Since the JVM does not exhaust 100% of resources, JVMkill will not be triggered. Therefore JVMQuake is introduced to provide more granular monitoring of GC behavior, enabling early detection of memory management issues and facilitating fast failure. Refers to the principle of jvmquake which is a JVMTI agent that attaches to your JVM and automatically signals and kills it when the program has become unstable.

Does this PR introduce any user-facing change?

No.

How was this patch tested?

JVMQuakeSuite

@SteNicholas SteNicholas force-pushed the CELEBORN-1092 branch 4 times, most recently from 1cf5f69 to 61dbd4c Compare November 1, 2023 10:02
Copy link

codecov bot commented Nov 1, 2023

Codecov Report

Attention: 14 lines in your changes are missing coverage. Please review.

Comparison is base (927d624) 46.81% compared to head (930129e) 47.06%.
Report is 2 commits behind head on main.

Files Patch % Lines
...cala/org/apache/celeborn/common/CelebornConf.scala 80.00% 13 Missing ⚠️
.../scala/org/apache/celeborn/common/util/Utils.scala 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2061      +/-   ##
==========================================
+ Coverage   46.81%   47.06%   +0.26%     
==========================================
  Files         173      173              
  Lines       10929    10995      +66     
  Branches     1009     1009              
==========================================
+ Hits         5115     5174      +59     
- Misses       5479     5483       +4     
- Partials      335      338       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@SteNicholas SteNicholas force-pushed the CELEBORN-1092 branch 14 times, most recently from e3b26d9 to b4aedb8 Compare November 2, 2023 05:19
@wangshengjie123
Copy link
Contributor

@SteNicholas nice idea, this feature is useful for debug memory problem in our spark production

@SteNicholas
Copy link
Member Author

@wangshengjie123, thanks for detailed review. I have addressed above comments. PTAL.

@wangshengjie123
Copy link
Contributor

LGTM, thanks @SteNicholas, cc @waitinfuture @FMX

@SteNicholas SteNicholas force-pushed the CELEBORN-1092 branch 2 times, most recently from 3e70971 to 40d430f Compare November 28, 2023 09:15
@SteNicholas SteNicholas requested a review from pan3793 November 28, 2023 09:15
Copy link
Contributor

@cfmcgrady cfmcgrady left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@cfmcgrady
Copy link
Contributor

thank you, merging to main(v0.4.0).

@cfmcgrady cfmcgrady closed this in 4dfcd9b Nov 28, 2023
SteNicholas pushed a commit that referenced this pull request Nov 4, 2024
### What changes were proposed in this pull request?

Add java tools.jar into classpath for JVM quake.

### Why are the changes needed?
Meet below issue with `celeborn.worker.jvmQuake.enabled=true`, see #2061
```
24/11/03 15:51:08,453 ERROR [main] Worker: Initialize worker failed.
java.lang.NoClassDefFoundError: sun/jvmstat/monitor/HostIdentifier
    at org.apache.celeborn.service.deploy.worker.monitor.JVMQuake$.monitoredVm$lzycompute(JVMQuake.scala:180)
    at org.apache.celeborn.service.deploy.worker.monitor.JVMQuake$.monitoredVm(JVMQuake.scala:179)
    at org.apache.celeborn.service.deploy.worker.monitor.JVMQuake$.ygcExitTimeMonitor$lzycompute(JVMQuake.scala:185)
    at org.apache.celeborn.service.deploy.worker.monitor.JVMQuake$.ygcExitTimeMonitor(JVMQuake.scala:184)
    at org.apache.celeborn.service.deploy.worker.monitor.JVMQuake$.org$apache$celeborn$service$deploy$worker$monitor$JVMQuake$$getLastExitTime(JVMQuake.scala:192)
    at org.apache.celeborn.service.deploy.worker.monitor.JVMQuake.start(JVMQuake.scala:66)
    at org.apache.celeborn.service.deploy.worker.Worker.<init>(Worker.scala:360)
    at org.apache.celeborn.service.deploy.worker.Worker$.main(Worker.scala:1041)
    at org.apache.celeborn.service.deploy.worker.Worker.main(Worker.scala)
Caused by: java.lang.ClassNotFoundException: sun.jvmstat.monitor.HostIdentifier
    at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 9 more
```

Related code:
https://github.com/apache/celeborn/blob/c12e8881ab5b03e39a8b53d038a283351bf5906c/project/JDKTools.scala#L58-L75

Similar issue: vladimirvivien/jmx-cli#4

After copy the `tools.jar` into worker-jars, the issue got resolved.

It is better that to involve the `tools.jar` automatically without copy.

### Does this PR introduce _any_ user-facing change?
No.

### How was this patch tested?
<img width="1202" alt="image" src="https://github.com/user-attachments/assets/af8f6c0d-9123-4a73-93b5-69836c5f826d">

Closes #2874 from turboFei/jdk_tools.

Authored-by: Wang, Fei <[email protected]>
Signed-off-by: SteNicholas <[email protected]>
SteNicholas pushed a commit that referenced this pull request Nov 4, 2024
### What changes were proposed in this pull request?

Add java tools.jar into classpath for JVM quake.

### Why are the changes needed?
Meet below issue with `celeborn.worker.jvmQuake.enabled=true`, see #2061
```
24/11/03 15:51:08,453 ERROR [main] Worker: Initialize worker failed.
java.lang.NoClassDefFoundError: sun/jvmstat/monitor/HostIdentifier
    at org.apache.celeborn.service.deploy.worker.monitor.JVMQuake$.monitoredVm$lzycompute(JVMQuake.scala:180)
    at org.apache.celeborn.service.deploy.worker.monitor.JVMQuake$.monitoredVm(JVMQuake.scala:179)
    at org.apache.celeborn.service.deploy.worker.monitor.JVMQuake$.ygcExitTimeMonitor$lzycompute(JVMQuake.scala:185)
    at org.apache.celeborn.service.deploy.worker.monitor.JVMQuake$.ygcExitTimeMonitor(JVMQuake.scala:184)
    at org.apache.celeborn.service.deploy.worker.monitor.JVMQuake$.org$apache$celeborn$service$deploy$worker$monitor$JVMQuake$$getLastExitTime(JVMQuake.scala:192)
    at org.apache.celeborn.service.deploy.worker.monitor.JVMQuake.start(JVMQuake.scala:66)
    at org.apache.celeborn.service.deploy.worker.Worker.<init>(Worker.scala:360)
    at org.apache.celeborn.service.deploy.worker.Worker$.main(Worker.scala:1041)
    at org.apache.celeborn.service.deploy.worker.Worker.main(Worker.scala)
Caused by: java.lang.ClassNotFoundException: sun.jvmstat.monitor.HostIdentifier
    at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 9 more
```

Related code:
https://github.com/apache/celeborn/blob/c12e8881ab5b03e39a8b53d038a283351bf5906c/project/JDKTools.scala#L58-L75

Similar issue: vladimirvivien/jmx-cli#4

After copy the `tools.jar` into worker-jars, the issue got resolved.

It is better that to involve the `tools.jar` automatically without copy.

### Does this PR introduce _any_ user-facing change?
No.

### How was this patch tested?
<img width="1202" alt="image" src="https://github.com/user-attachments/assets/af8f6c0d-9123-4a73-93b5-69836c5f826d">

Closes #2874 from turboFei/jdk_tools.

Authored-by: Wang, Fei <[email protected]>
Signed-off-by: SteNicholas <[email protected]>
(cherry picked from commit d4044c5)
Signed-off-by: SteNicholas <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants