JvmMemoryFillingUp #
JVM memory is filling up (> 80%)
Alert Rule
alert: JvmMemoryFillingUp
annotations:
description: |-
JVM memory is filling up (> 80%)
VALUE = {{ $value }}
LABELS = {{ $labels }}
runbook: https://srerun.github.io/prometheus-alerts/runbooks/jvm-exporter/jvmmemoryfillingup/
summary: JVM memory filling up (instance {{ $labels.instance }})
expr: (sum by (instance)(jvm_memory_used_bytes{area="heap"}) / sum by (instance)(jvm_memory_max_bytes{area="heap"}))
* 100 > 80
for: 2m
labels:
severity: warning
Meaning #
The JvmMemoryFillingUp
alert is triggered when the JVM heap memory usage exceeds 80% of the maximum allowed memory. This alert indicates that the JVM is running low on heap memory, which can lead to performance degradation, increased garbage collection, and potentially even application crashes.
Impact #
The impact of high JVM memory usage includes:
- Slower application performance due to increased garbage collection
- Increased risk of application crashes and restarts
- Potential data loss or corruption due to failed transactions
- Decreased system reliability and availability
Diagnosis #
To diagnose the root cause of high JVM memory usage, follow these steps:
- Check the JVM memory usage graph to determine the trend and pattern of memory usage.
- Investigate recent changes to the application, such as new feature deployments or increased traffic, that may be contributing to the memory usage spike.
- Review JVM garbage collection logs to identify any issues with garbage collection, such as frequent full GCs or long pause times.
- Verify that the JVM is properly configured, including the heap size, garbage collection algorithm, and other memory-related settings.
- Check for any memory leaks or inefficient memory allocation in the application code.
Mitigation #
To mitigate high JVM memory usage, follow these steps:
- Increase the JVM heap size to provide more memory for the application, if possible.
- Optimize the application code to reduce memory allocation and garbage collection.
- Implement caching or other memory-efficient strategies to reduce memory usage.
- Configure the JVM garbage collection algorithm to reduce pause times and improve performance.
- Consider horizontal scaling or load balancing to distribute the load and reduce memory usage per instance.
- Monitor JVM memory usage closely and alert on any further increases to prevent further degradation.