From b1cc966439a65f8be1b3973b16753dfba2b51c37 Mon Sep 17 00:00:00 2001 From: Dana Powers Date: Mon, 19 Jun 2017 10:16:02 -0700 Subject: KIP-144: Exponential backoff for broker reconnections (#1124) --- kafka/consumer/group.py | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'kafka/consumer/group.py') diff --git a/kafka/consumer/group.py b/kafka/consumer/group.py index 15a8947..6adb154 100644 --- a/kafka/consumer/group.py +++ b/kafka/consumer/group.py @@ -91,6 +91,14 @@ class KafkaConsumer(six.Iterator): reconnect_backoff_ms (int): The amount of time in milliseconds to wait before attempting to reconnect to a given host. Default: 50. + reconnect_backoff_max_ms (int): The maximum amount of time in + milliseconds to wait when reconnecting to a broker that has + repeatedly failed to connect. If provided, the backoff per host + will increase exponentially for each consecutive connection + failure, up to this maximum. To avoid connection storms, a + randomization factor of 0.2 will be applied to the backoff + resulting in a random range between 20% below and 20% above + the computed value. Default: 1000. max_in_flight_requests_per_connection (int): Requests are pipelined to kafka brokers up to this number of maximum requests per broker connection. Default: 5. @@ -230,6 +238,7 @@ class KafkaConsumer(six.Iterator): 'request_timeout_ms': 40 * 1000, 'retry_backoff_ms': 100, 'reconnect_backoff_ms': 50, + 'reconnect_backoff_max_ms': 1000, 'max_in_flight_requests_per_connection': 5, 'auto_offset_reset': 'latest', 'enable_auto_commit': True, -- cgit v1.2.1