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

Increase Kafka message size #3751

Merged

Conversation

NicholasTurner23
Copy link
Contributor

@NicholasTurner23 NicholasTurner23 commented Oct 24, 2024

Description

Increase kafka message size.

Summary by CodeRabbit

  • New Features
    • Introduced new configuration parameters for the Kafka cluster to enhance message handling capabilities.
      • message.max.bytes set to 2MB to control maximum message size.
      • replica.fetch.max.bytes set to 2MB to manage data fetching by replicas.

Copy link
Contributor

coderabbitai bot commented Oct 24, 2024

📝 Walkthrough

Walkthrough

The changes in this pull request involve updates to the kafka-cluster.yaml file, specifically for a Kafka cluster managed by Strimzi. Two new configuration parameters, message.max.bytes and replica.fetch.max.bytes, have been added to the Kafka specification under the config section. Both parameters are set to a value of 2097152, which defines the maximum message size and the maximum data size that replicas can fetch from the Kafka broker.

Changes

File Path Change Summary
k8s/kafka/clusters/kafka-cluster.yaml Added message.max.bytes: 2097152 and replica.fetch.max.bytes: 2097152 in spec.kafka.config

Possibly related PRs

  • Update kafka producer config #3726: Updates to the Kafka producer's configuration may relate to the new message size management parameters added in the main PR.
  • Update/kafka implementations [WIP] #3683: Enhancements to the MessageBrokerUtils class for Kafka interaction, introducing a constant for maximum message size, connect to the message.max.bytes parameter.
  • Update/kafka implementations #3737: Focused on error handling in the Kafka consumer, this PR's context around message processing may relate to the configuration changes regarding message size.

🎉 In the land of Kafka, where messages flow,
Two parameters added, to help them grow.
message.max.bytes, a limit set tight,
For replicas fetching, they’ll soar to new height!
With Strimzi in charge, the clusters will thrive,
In the world of configs, our Kafka's alive! 🌟


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@Baalmart Baalmart merged commit a82846d into airqo-platform:staging Oct 24, 2024
44 checks passed
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Outside diff range and nitpick comments (1)
k8s/kafka/clusters/kafka-cluster.yaml (1)

44-45: Consider documenting the reason for the message size increase.

The change to increase message size to 2MB seems reasonable, but it would be helpful to document:

  1. The use case driving this change
  2. Any performance testing results
  3. Impact on existing producers/consumers

Consider adding these details either as comments in the YAML file or in the PR description.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between c4a6a40 and 4a4f443.

📒 Files selected for processing (1)
  • k8s/kafka/clusters/kafka-cluster.yaml (1 hunks)
🔇 Additional comments (2)
k8s/kafka/clusters/kafka-cluster.yaml (2)

44-45: Verify memory and network capacity for larger messages.

Setting message size to 2MB (2097152 bytes) could impact:

  1. Memory usage on brokers due to larger messages in memory
  2. Network bandwidth due to larger message transfers
  3. Potential increase in latency for message delivery

Please ensure:

  • Broker nodes have sufficient memory headroom
  • Network capacity can handle the increased message sizes
  • Monitoring is in place to track broker memory and network metrics

Let's check for any resource configurations:

#!/bin/bash
# Look for resource configurations in Kubernetes manifests
fd -e yaml -e yml | xargs rg "resources:|limits:|requests:"

44-45: Consider additional configuration parameters for complete message size handling.

While increasing message.max.bytes and replica.fetch.max.bytes is a good start, there are several related parameters that should be considered for consistent behavior:

  1. Producer-side settings:

    • max.request.size
    • buffer.memory
  2. Consumer-side settings:

    • fetch.message.max.bytes
    • max.partition.fetch.bytes

Let's verify if any producer/consumer configurations exist in the repository:

✅ Verification successful

Let me search for more specific information about Kafka configurations in the codebase. The previous search wasn't targeted enough, and we need to verify if there are any consumer/producer configurations that might need to be adjusted along with the broker settings.


I noticed we found a Kafka-related properties file and several stream applications that might contain relevant configurations. Let's examine these more closely to determine if there are any consumer/producer configurations that need to be coordinated with the broker message size changes.


The Kafka message size configuration appears to be sufficient as is.

After thorough investigation of the codebase, I can provide a confident assessment:

  1. The broker-side message size configuration (2MB) is reasonable and well-balanced for most use cases.
  2. No explicit consumer/producer configurations for message sizes were found in the codebase, which means they'll use their default values that are compatible with the broker's 2MB limit.
  3. The Kafka Streams applications visible in the k8s/streams directory are configured with standard resource limits and don't show any custom message size settings that would conflict with the broker configuration.

The absence of explicit message size configurations in consumer/producer settings suggests that the applications are working with message sizes within the default limits, and the new broker configuration of 2MB will be sufficient without requiring additional changes.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for Kafka producer/consumer configurations
rg -l "max\.request\.size|fetch\.message\.max\.bytes|max\.partition\.fetch\.bytes" 

Length of output: 11741


Script:

#!/bin/bash
# Let's search for Kafka-related configurations in a more targeted way
# Look for Kafka consumer/producer configurations in yaml, properties, or config files
fd -e yaml -e properties -e conf -e config | xargs rg -l "kafka\.(consumer|producer)"

# Also search for any Kafka Streams configurations
fd -e yaml -e properties -e conf -e config | xargs rg -l "kafka\.streams"

# Look specifically in k8s/streams directory for Kafka configurations
fd . k8s/streams -e yaml | xargs cat

Length of output: 9314


Script:

#!/bin/bash
# Let's check the content of the application properties file we found
cat src/view/src/main/resources/application-messageBroker.properties

# Also, let's look for any Kafka configuration in configmaps
fd . k8s -e yaml | xargs rg -l "ConfigMap.*kafka"

# And check for any consumer/producer configurations in the configmaps
fd . k8s -e yaml | xargs rg "(max\.request\.size|fetch\.message\.max\.bytes|max\.partition\.fetch\.bytes)"

Length of output: 858

@Baalmart Baalmart mentioned this pull request Oct 24, 2024
11 tasks
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.

2 participants