Keycloak JVM Metrics
This documentation covers the information about the key JVM metrics for observing the performance of Keycloak.
Enable Keycloak metrics
Keycloak exposes metrics on the management interface endpoint /metrics
.
To enable, use the build time option --metrics-enabled=true
.
On a Kubernetes cluster, using the Keycloak Operator, metrics can be enabled by in the Keycloak CR addionalOptions
as shown below:
apiVersion: k8s.keycloak.org/v2alpha1
kind: Keycloak
metadata:
labels:
app: keycloak
name: keycloak
spec:
additionalOptions:
- name: metrics-enabled
value: 'true'
Additional information can be found here.
JVM info
Metric | Description |
---|---|
jvm_info_total |
Information about the JVM such as version, runtime and vendor. |
Heap Memory Usage
Metric | Description |
---|---|
|
The amount of memory that the JVM has committed for use, reflecting the portion of the allocated memory that is guaranteed to be available for the JVM to use. |
|
The amount of memory currently used by the JVM, indicating the actual memory consumption by the application and JVM internals. |
Garbage Collection Metrics
Metric | Description |
---|---|
|
The maximum duration, in seconds, of garbage collection pauses experienced by the JVM due to a particular cause, which helps you quickly differentiate between types of GC (minor, major) pauses. |
|
The total cumulative time spent in garbage collection pauses, indicating the impact of GC pauses on application performance in the JVM. |
|
Counts the total number of garbage collection pause events, helping to assess the frequency of GC pauses in the JVM. |
|
The percentage of CPU time spent on garbage collection, indicating the impact of GC on application performance in the JVM. It refers to the proportion of the total CPU processing time that is dedicated to executing garbage collection (GC) operations, as opposed to running application code or performing other tasks. This metric helps determine how much overhead GC introduces, affecting the overall performance of the Keycloak’s JVM. |
Additional information on the Keycloak metrics
endpoint can be found here.