mirror of
https://github.com/datahub-project/datahub.git
synced 2025-08-31 21:03:03 +00:00
Co-authored-by: yangjd33 <yangjd33@chinaunicom.cn> Co-authored-by: david-leifker <114954101+david-leifker@users.noreply.github.com>
This commit is contained in:
parent
22e77710f2
commit
5588a04bc5
@ -9,7 +9,8 @@ RUN addgroup -S datahub && adduser -S datahub -G datahub
|
||||
# PFP-260: Upgrade Sqlite to >=3.28.0-r0 to fix https://security.snyk.io/vuln/SNYK-ALPINE39-SQLITE-449762
|
||||
RUN apk --no-cache --update-cache --available upgrade \
|
||||
&& apk --no-cache add curl sqlite \
|
||||
&& apk --no-cache add openjdk11-jre --repository=http://dl-cdn.alpinelinux.org/alpine/edge/community
|
||||
&& apk --no-cache add openjdk11-jre --repository=http://dl-cdn.alpinelinux.org/alpine/edge/community \
|
||||
&& apk --no-cache add jattach --repository http://dl-cdn.alpinelinux.org/alpine/edge/community/
|
||||
|
||||
FROM base as prod-install
|
||||
|
||||
|
@ -20,6 +20,7 @@ ENV JMX_VERSION=0.18.0
|
||||
RUN apk --no-cache --update-cache --available upgrade \
|
||||
&& apk --no-cache add curl bash coreutils gcompat sqlite \
|
||||
&& apk --no-cache add openjdk11-jre --repository=http://dl-cdn.alpinelinux.org/alpine/edge/community \
|
||||
&& apk --no-cache add jattach --repository http://dl-cdn.alpinelinux.org/alpine/edge/community/ \
|
||||
&& curl -sS https://repo1.maven.org/maven2/org/eclipse/jetty/jetty-runner/9.4.46.v20220331/jetty-runner-9.4.46.v20220331.jar --output jetty-runner.jar \
|
||||
&& curl -sS https://repo1.maven.org/maven2/org/eclipse/jetty/jetty-jmx/9.4.46.v20220331/jetty-jmx-9.4.46.v20220331.jar --output jetty-jmx.jar \
|
||||
&& curl -sS https://repo1.maven.org/maven2/org/eclipse/jetty/jetty-util/9.4.46.v20220331/jetty-util-9.4.46.v20220331.jar --output jetty-util.jar \
|
||||
|
@ -20,6 +20,7 @@ ENV JMX_VERSION=0.18.0
|
||||
RUN apk --no-cache --update-cache --available upgrade \
|
||||
&& apk --no-cache add curl bash coreutils sqlite \
|
||||
&& apk --no-cache add openjdk11-jre --repository=http://dl-cdn.alpinelinux.org/alpine/edge/community \
|
||||
&& apk --no-cache add jattach --repository http://dl-cdn.alpinelinux.org/alpine/edge/community/ \
|
||||
&& wget --no-verbose https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/download/v1.24.0/opentelemetry-javaagent.jar \
|
||||
&& wget --no-verbose https://repo1.maven.org/maven2/io/prometheus/jmx/jmx_prometheus_javaagent/${JMX_VERSION}/jmx_prometheus_javaagent-${JMX_VERSION}.jar -O jmx_prometheus_javaagent.jar \
|
||||
&& cp /usr/lib/jvm/java-11-openjdk/jre/lib/security/cacerts /tmp/kafka.client.truststore.jks
|
||||
|
@ -20,6 +20,7 @@ ENV JMX_VERSION=0.18.0
|
||||
RUN apk --no-cache --update-cache --available upgrade \
|
||||
&& apk --no-cache add curl bash sqlite \
|
||||
&& apk --no-cache add openjdk11-jre --repository=http://dl-cdn.alpinelinux.org/alpine/edge/community \
|
||||
&& apk --no-cache add jattach --repository http://dl-cdn.alpinelinux.org/alpine/edge/community/ \
|
||||
&& wget --no-verbose https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/download/v1.24.0/opentelemetry-javaagent.jar \
|
||||
&& wget --no-verbose https://repo1.maven.org/maven2/io/prometheus/jmx/jmx_prometheus_javaagent/${JMX_VERSION}/jmx_prometheus_javaagent-${JMX_VERSION}.jar -O jmx_prometheus_javaagent.jar \
|
||||
&& cp /usr/lib/jvm/java-11-openjdk/jre/lib/security/cacerts /tmp/kafka.client.truststore.jks
|
||||
|
@ -188,6 +188,7 @@ module.exports = {
|
||||
"docs/how/kafka-config",
|
||||
"docs/deploy/confluent-cloud",
|
||||
"docs/advanced/no-code-upgrade",
|
||||
"docs/how/jattach-guide",
|
||||
],
|
||||
},
|
||||
"docs/how/updating-datahub",
|
||||
|
80
docs/how/jattach-guide.md
Normal file
80
docs/how/jattach-guide.md
Normal file
@ -0,0 +1,80 @@
|
||||
---
|
||||
title: "Debugging by Jattach"
|
||||
hide_title: true
|
||||
---
|
||||
We have installed jattach in Docker image of datahub-gms, datahub-mae-consumer, datahub-mce-consumer
|
||||
and datahub-frontend to facilitating troubleshooting in a production environment.
|
||||
|
||||
# Introduction to Jattach
|
||||
Jattach is a utility to send commands to a JVM process via Dynamic Attach mechanism.
|
||||
|
||||
Supported commands:
|
||||
- load : load agent library
|
||||
- properties : print system properties
|
||||
- agentProperties : print agent properties
|
||||
- datadump : show heap and thread summary
|
||||
- threaddump : dump all stack traces (like jstack)
|
||||
- dumpheap : dump heap (like jmap)
|
||||
- inspectheap : heap histogram (like jmap -histo)
|
||||
- setflag : modify manageable VM flag
|
||||
- printflag : print VM flag
|
||||
- jcmd : execute jcmd command
|
||||
|
||||
# Use examples
|
||||
|
||||
Jattach is a All-in-one **jmap + jstack + jcmd + jinfo** functionality in a single tiny program.
|
||||
The scenarios where these commands were previously used can now be replaced with jattach.
|
||||
|
||||
## Example 1: Dump heap
|
||||
The jattach dumpheap command is typically used in the following scenarios:
|
||||
|
||||
- Memory leak analysis: When an application experiences memory leaks or abnormal memory growth, the jattach dumpheap
|
||||
command is used to generate a heap dump file for further analysis and identification of the memory leak causes.
|
||||
|
||||
- Memory analysis: By generating a heap dump file, various memory analysis tools such as Eclipse Memory Analyzer and
|
||||
VisualVM can be utilized to analyze objects, reference relationships, and memory usage within the heap. This helps
|
||||
identify potential performance issues and optimization opportunities.
|
||||
|
||||
- Troubleshooting: When encountering frequent Full GCs, memory out-of-memory errors, or other memory-related issues,
|
||||
generating a heap dump file provides additional information for troubleshooting and debugging purposes.
|
||||
|
||||
- Performance optimization: By analyzing the heap dump file, it becomes possible to identify which objects in the
|
||||
application consume a significant amount of memory. This information can be used for targeted performance optimizations,
|
||||
such as reducing object creation or optimizing cache usage.
|
||||
|
||||
It's important to note that generating a heap dump file can have an impact on the performance of the application.
|
||||
Therefore, caution should be exercised when using it in a production environment, ensuring sufficient resources and
|
||||
permissions are available for the operation.
|
||||
|
||||
The command is as follows:
|
||||
```bash
|
||||
jattach <pid> dumpheap /tmp/heap.bin
|
||||
```
|
||||
|
||||
## Example 2: Dump thread
|
||||
The jattach threaddump command is typically used in the following scenarios:
|
||||
|
||||
- Deadlock analysis: When an application experiences deadlocks or thread contention issues, the jattach threaddump
|
||||
command is used to generate a thread dump file. It provides the current thread's stack trace information, helping to
|
||||
identify the code paths and lock contention causing the deadlock.
|
||||
|
||||
- Thread troubleshooting: When threads in an application encounter exceptions, long blocking times, excessive CPU usage,
|
||||
or other issues, generating a thread dump file provides detailed information about each thread's state, stack trace, and
|
||||
resource usage. This helps with troubleshooting and analysis.
|
||||
|
||||
- Performance analysis: By generating a thread dump file, it becomes possible to understand the thread activity, call
|
||||
paths, and resource contention within the application. This aids in identifying potential performance bottlenecks and
|
||||
concurrency issues.
|
||||
|
||||
- Monitoring and diagnostics: Regularly generating thread dump files can be used to monitor the health of an application
|
||||
and provide historical data for subsequent diagnostics. This helps gain a better understanding of the application's
|
||||
behavior and performance.
|
||||
|
||||
It's important to note that generating a thread dump file may impact the performance of the application. Therefore,
|
||||
caution should be exercised when using it in a production environment, ensuring sufficient resources and permissions
|
||||
are available for the operation.
|
||||
|
||||
The command is as follows:
|
||||
```bash
|
||||
jattach <pid> threaddump -l > /tmp/jstack.out
|
||||
```
|
Loading…
x
Reference in New Issue
Block a user