afkak icon indicating copy to clipboard operation
afkak copied to clipboard

Consumer: max fetch time defaults don't match

Open twm opened this issue 6 years ago • 1 comments
trafficstars

The Consumer class's fetch_max_wait_time parameter defaults to FETCH_MAX_WAIT_TIME = 100 milliseconds:

https://github.com/ciena/afkak/blob/b7e0a716881ff776e15843465586a4cbd942cb6c/afkak/consumer.py#L46-L47

Internally, Consumer calls KafkaClient.send_fetch_request(). This method has a max_wait_time parameter with a default value of KafkaClient.DEFAULT_FETCH_SERVER_WAIT_MSECS: https://github.com/ciena/afkak/blob/b7e0a716881ff776e15843465586a4cbd942cb6c/afkak/client.py#L151-L158

It doesn't make sense that there are two sets of defaults. It doesn't make sense that they differ.

The defaults in KafkaClient probably affect 0 real users, since everyone uses the Consumer wrapper. They don't really make sense, either. If you want to reduce polling overhead by increasing the fetch long poll period you probably want to reduce the fetch size to something like 1, lest you add tons of latency when the message rate is low.

twm avatar Sep 10 '19 00:09 twm

There's another set of defaults on KafkaCodec.encode_fetch_request():

https://github.com/ciena/afkak/blob/b7e0a716881ff776e15843465586a4cbd942cb6c/afkak/kafkacodec.py#L361-L362

twm avatar Sep 10 '19 00:09 twm