Skip to content

Kafka notifications: connections.max.idle.ms and retry policy #4715

@fgalan

Description

@fgalan

As a continuation of issue #4666, the producer created in KafkaConnectionManager::getConnection() is not currently setting the connections.max.idle.ms.

See more details at #4666 (comment)

Kafka producers have the configuration parameter connections.max.idle.ms to close inactive sockets (without destroying the producer). This releases network resources without destroying the producer. If the producer needs to send a message after the socket is closed, it automatically opens a new connection. Kafka does not “reconnect” the same closed TCP connection; it creates a new one (to the same broker). However, the producer object (rd_kafka_t) remains the same, keeping its configuration and internal state. It does not free the producer’s memory.

What should we do in Orion? Avoid destroying producers, or be very conservative about doing so—destroy them only when strictly necessary.

When would we need to destroy the producer in Orion?

If we need to apply credential changes, which is not implemented at the moment.

Inactive clusters (long periods) — cleanup should be conservative (30+ days).

This leads to the following issue:

  1. Apply the connections.max.idle.ms configuration to the Kafka producer (improvement)

As a side setting, the retry policy should be also set.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions