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

Increased memory usage with GetMetadata call #1172

Open
4 of 7 tasks
skedia-confluent opened this issue Apr 10, 2024 · 0 comments
Open
4 of 7 tasks

Increased memory usage with GetMetadata call #1172

skedia-confluent opened this issue Apr 10, 2024 · 0 comments

Comments

@skedia-confluent
Copy link
Member

skedia-confluent commented Apr 10, 2024

Description

Our application uses the Producer client to make the GetMetadata API call. We have observed that the application's memory usage increases whenever it makes this call. Interestingly, it does not go back to the original value thereafter. The increase appears to be directly proportional to the number of topics.

To confirm that the issue is with the package, we wrote a simple application to just create a new producer client and make the GetMetadata call in a loop. The memory usage graph looks like this

Screenshot 2024-04-10 at 17 19 37

It can be seen that memory usage increased from around 1.5MB before the loop to around 60MB during the loop and then settled at 23MB after the loop.

We tried the same thing with Admin client. The memory usage graph looks like this

Screenshot 2024-04-10 at 16 58 05

It shows a similar pattern with lower values. Memory usage increased from 1MB before the loop to 23MB during the loop and then settled at 19MB after the loop.

How to reproduce

It can be reproduced by creating the client and making the GetMetadata call in a loop.
Code:

func getProducerConfig(namespace string) *kafka.ConfigMap {
	conf := &kafka.ConfigMap{}
	setupSSL(conf, namespace)
	return conf
}

func setupSSL(conf *kafka.ConfigMap, namespace string) {
	conf.SetKey("bootstrap.servers", fmt.Sprintf("kafka.%s.svc.cluster.local:9075", namespace))
	conf.SetKey("security.protocol", "SSL")
	conf.SetKey("ssl.endpoint.identification.algorithm", "none")
}

func GetProducer(namespace string) (*kafka.AdminClient, error) {
	config := getProducerConfig(namespace)
	return kafka.NewAdminClient(config)
}

func main() {
	time.Sleep(3 * time.Minute)
	for i := 1; i <= 15; i++ {
		producer, _ := GetProducer(<namespace>)
		producer.GetMetadata(nil, true, 10000)
		producer.Close()
		time.Sleep(1 * time.Minute)
	}
	select {}
}

Checklist

Please provide the following information:

  • confluent-kafka-go and librdkafka version (v2.3.0):
  • Apache Kafka broker version:
  • Client configuration: ConfigMap{...}
"bootstrap.servers": <bootstrap_server>,
"security.protocol": "SSL",
"ssl.endpoint.identification.algorithm": "none",
  • Operating system: Linux
  • Provide client logs (with "debug": ".." as necessary)
  • Provide broker log excerpts
  • Critical issue
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

No branches or pull requests

1 participant