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

JMX exporter high memory usage. #929

Closed
harshal-choudhari-9393 opened this issue Mar 26, 2024 · 3 comments
Closed

JMX exporter high memory usage. #929

harshal-choudhari-9393 opened this issue Mar 26, 2024 · 3 comments

Comments

@harshal-choudhari-9393
Copy link

I'm employing an independent JMX exporter in conjunction with Kafka Connect to retrieve Kafka Connect metrics in Prometheus within a Kubernetes pod. Specifically, I'm utilizing version 0.20 of the JMX exporter. With approximately 9000 topics in Kafka, I've allocated 5G of memory to the pod. Upon initiating the JMX exporter, JMX memory utilization promptly surges to 100%, leading to the termination of the pod and consequently halting Kafka Connect. I retrieved high cardinality metrics and attempted to mitigate this issue by deactivating them using the provided configuration However, I am still receiving all the metrics that I have attempted to disable.

excludeObjectNames: ["kafka.log:type=Log, name=Size,*"......]

Could you please guide me on reducing memory usage for the JMX exporter and disabling unnecessary metrics? Also, Let me know if any further information is needed.

@dhoard
Copy link
Collaborator

dhoard commented Apr 1, 2024

@harshal-choudhari-9393 can you provide your JMX Exporter YAML configuration file?

@harshal-choudhari-9393
Copy link
Author

Sure. Here is the YAML for the JMX exporter.

lowercaseOutputName: true
excludeObjectNames: ["kafka.server:type=BrokerTopicMetrics, name=TotalFetchRequestsPerSec,*","kafka.cluster:type=Partition, name=UnderReplicated,*", "kafka.log:name=Size,type=Log,*","kafka.cluster:type=Partition,name=ReplicasCount,*"]
rules:
# Special cases and very specific rules
- pattern: kafka.server<type=(.+), name=(.+), clientId=(.+), topic=(.+), partition=(.*)><>Value
  name: kafka_server_$1_$2
  type: GAUGE
  labels:
    clientId: "$3"
    topic: "$4"
    partition: "$5"
- pattern: kafka.server<type=(.+), name=(.+), clientId=(.+), brokerHost=(.+), brokerPort=(.+)><>Value
  name: kafka_server_$1_$2
  type: GAUGE
  labels:
    clientId: "$3"
    broker: "$4:$5"
- pattern: kafka.coordinator.(\w+)<type=(.+), name=(.+)><>Value
  name: kafka_coordinator_$1_$2_$3
  type: GAUGE

# Generic per-second counters with 0-2 key/value pairs
- pattern: kafka.(\w+)<type=(.+), name=(.+)PerSec\w*, (.+)=(.+), (.+)=(.+)><>Count
  name: kafka_$1_$2_$3_total
  type: COUNTER
  labels:
    "$4": "$5"
    "$6": "$7"
- pattern: kafka.(\w+)<type=(.+), name=(.+)PerSec\w*, (.+)=(.+)><>Count
  name: kafka_$1_$2_$3_total
  type: COUNTER
  labels:
    "$4": "$5"
- pattern: kafka.(\w+)<type=(.+), name=(.+)PerSec\w*><>Count
  name: kafka_$1_$2_$3_total
  type: COUNTER

# Generic gauges with 0-2 key/value pairs
- pattern: kafka.(\w+)<type=(.+), name=(.+), (.+)=(.+), (.+)=(.+)><>Value
  name: kafka_$1_$2_$3
  type: GAUGE
  labels:
    "$4": "$5"
    "$6": "$7"
- pattern: kafka.(\w+)<type=(.+), name=(.+), (.+)=(.+)><>Value
  name: kafka_$1_$2_$3
  type: GAUGE
  labels:
    "$4": "$5"
- pattern: kafka.(\w+)<type=(.+), name=(.+)><>Value
  name: kafka_$1_$2_$3
  type: GAUGE

# Emulate Prometheus 'Summary' metrics for the exported 'Histogram's.
#
# Note that these are missing the '_sum' metric!
- pattern: kafka.(\w+)<type=(.+), name=(.+), (.+)=(.+), (.+)=(.+)><>Count
  name: kafka_$1_$2_$3_count
  type: COUNTER
  labels:
    "$4": "$5"
    "$6": "$7"
- pattern: kafka.(\w+)<type=(.+), name=(.+), (.+)=(.*), (.+)=(.+)><>(\d+)thPercentile
  name: kafka_$1_$2_$3
  type: GAUGE
  labels:
    "$4": "$5"
    "$6": "$7"
    quantile: "0.$8"
- pattern: kafka.(\w+)<type=(.+), name=(.+), (.+)=(.+)><>Count
  name: kafka_$1_$2_$3_count
  type: COUNTER
  labels:
    "$4": "$5"
- pattern: kafka.(\w+)<type=(.+), name=(.+), (.+)=(.+)><>Value
  name: kafka_$1_$2_$3_value
  type: GAUGE
  labels:
    "$4": "$5"
- pattern: kafka.(\w+)<type=(.+), name=(.+), (.+)=(.+)><>OneMinuteRate
  name: kafka_$1_$2_$3_rate
  type: GAUGE
  labels:
    "$4": "$5"
- pattern: kafka.(\w+)<type=(.+), name=(.+), (.+)=(.*)><>(\d+)thPercentile
  name: kafka_$1_$2_$3
  type: GAUGE
  labels:
    "$4": "$5"
    quantile: "0.$6"
- pattern: kafka.(\w+)<type=(.+), name=(.+)><>Count
  name: kafka_$1_$2_$3_count
  type: COUNTER
- pattern: kafka.(\w+)<type=(.+), name=(.+)><>Value
  name: kafka_$1_$2_$3_value
  type: GAUGE
- pattern: kafka.(\w+)<type=(.+), name=(.+)><>OneMinuteRate
  name: kafka_$1_$2_$3_rate
  type: GAUGE
- pattern: kafka.(\w+)<type=(.+), name=(.+)><>(\d+)thPercentile
  name: kafka_$1_$2_$3
  type: GAUGE
  labels:
    quantile: "0.$4"```

@dhoard
Copy link
Collaborator

dhoard commented Apr 3, 2024

@harshal-choudhari-9393 Can you provide your solution/resolution for future information?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants