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

Normalize Kafka configuration units to bytes #5530

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

dorbae
Copy link

@dorbae dorbae commented Feb 10, 2025

Normalize Kafka configuration units to bytes for message and request size parameters.

Description

Kafka configuration units related to size are in bytes. However, ByteSize supports various units. I believe it's better to normalize the unit to bytes to help reduce human errors.

For example, if max-message-bytes is set with an MB unit, the topic configuration could mistakenly interpret it as 3 bytes instead of 3 MB:

// application.conf
whisk {
  kafka {
     ...
     events {
                segment-bytes   =  536870912
                retention-bytes = 1073741824
                retention-ms    = 3600000
                max-message-bytes = 3 m
            }

Currently, several topics set max.message.bytes as ${whisk.activation.kafka.payload.max} + ${whisk.activation.kafka.serdes-overhead}. Fortunately, this ensures the unit remains in bytes when summing the two values.

Despite this, I believe normalizing the unit to bytes will help prevent unexpected bugs.

Related issue and scope

  • I opened an issue to propose and discuss this change (#????)

My changes affect the following components

  • API
  • Controller
  • Message Bus (e.g., Kafka)
  • Loadbalancer
  • Scheduler
  • Invoker
  • Intrinsic actions (e.g., sequences, conductors)
  • Data stores (e.g., CouchDB)
  • Tests
  • Deployment
  • CLI
  • General tooling
  • Documentation

Types of changes

  • Bug fix (generally a non-breaking change which closes an issue).
  • Enhancement or new feature (adds new functionality).
  • Breaking change (a bug fix or enhancement which changes existing behavior).

Checklist:

  • I signed an Apache CLA.
  • I reviewed the style guides and followed the recommendations (Travis CI will check :).
  • I added tests to cover my changes.
  • My changes require further changes to the documentation.
  • I updated the documentation where necessary.

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

Successfully merging this pull request may close these issues.

1 participant