Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Please keep the discussion on the mailing list rather than commenting on the wiki (wiki discussions get unwieldy fast).

Motivation

Describe the problems you are trying to solve.

When remote storage is enabled for on a topic, and the consumer is doing backfill, then the data might be is read from the remote storage. Currently, Kafka remote storage supports only reading the first remote partition in the given FETCH request. The default value of max.partition.fetch.bytes  is configured to 1 MB. Reading one MB of data per FETCH request, increases the round-trip time for the consumer and the cloud storages are often tuned to read data in chunks of 4 MB. 

The proposal is to introduce remote.max.partition.fetch.bytes  in the Consumer config which allows the user to tune the value depending on their storage plugin. The user might want to optimize the number of calls to remote storage vs the amount of bytes returned back to the client in the FETCH response.

Public Interfaces

...

A public interface is any change to the following:

  • Introduce new remote.max.partition.fetch.bytes consumer config, with default value to 1 MB.
  • Bump FetchRequest to v18 to add the RemotePartitionMaxBytes field to propagate the value configured on the consumer to the broker. 

...

  • Binary log format

  • The network protocol and api behavior

  • Any class in the public packages under clientsConfiguration, especially client configuration

    • org/apache/kafka/common/serialization

    • org/apache/kafka/common

    • org/apache/kafka/common/errors

    • org/apache/kafka/clients/producer

    • org/apache/kafka/clients/consumer (eventually, once stable)

  • Monitoring

  • Command line tools and arguments

  • Anything else that will likely break existing users in some way when they upgrade

Proposed Changes

...

The proposal is to introduce a new Consumer config: remote.max.partition.fetch.bytes to configure the number of bytes returned from remote storage .  
 The in a FETCH request. The reason for not reusing re-using the existing the max.partition.fetch.bytes  config. is that:

  1. The default value of fetch.max.bytes  is configured set to 50 MB and max.partition.fetch.bytes is 1 MB.
  2. If the user tunes increases the max.partition.fetch.bytes value to 4 MB, then it applies for all the partitions in the FETCH requests. (ie) Reading the data from local storage too.
  3. Assume that the consumer is reading data for from a topic with 64 partitions and 16 partition leaders are colocated co-located in a single broker. Then: 
    1. Broker allocates 16 12 instances of 4 MB buffers which will impact (12 x 4 = 50 MB) which might trigger the Young Gen and Old Gen GC when there are many FETCH requests from different consumers.
    2. Broker does not use BufferPool to allocate the buffers. 
  4. Since
    1. Allocating big byte-buffers have direct impact on GCs.
  5. Remote read gets triggered for only one partition in a given FETCH request. And, we want to allocate the big byte-buffer (4 MB) only for remote read requests.The existing  cannot be reused to read from remote storage. 



Compatibility, Deprecation, and Migration Plan

...