kafka-perf-review
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseKafka Performance Configuration Review
Kafka性能配置审查
Reviews producer and consumer configurations in both the live cluster and the codebase for performance anti-patterns. These settings are the same across all Kafka client libraries (they're Kafka protocol properties).
审查实时集群和代码库中的生产者与消费者配置,排查性能反模式。这些设置在所有Kafka客户端库中通用(属于Kafka协议属性)。
Workflow
工作流程
Copy this checklist and track your progress:
Performance Review Progress:
- [ ] Step 1: Inspect live cluster configs
- [ ] Step 2: Scan codebase for producer/consumer configs
- [ ] Step 3: Audit producer configs
- [ ] Step 4: Audit consumer configs
- [ ] Step 5: Cross-reference cluster and code configs
- [ ] Step 6: Generate report- Inspect live cluster configs via Lenses MCP
- Scan codebase for producer/consumer config properties (see and
references/producer-defaults.md)references/consumer-defaults.md - Audit producer configs against recommended values
- Audit consumer configs against recommended values
- Cross-reference cluster and code configs
- Report findings with current values, recommended values and trade-off explanations
复制以下检查清单并跟踪进度:
Performance Review Progress:
- [ ] Step 1: Inspect live cluster configs
- [ ] Step 2: Scan codebase for producer/consumer configs
- [ ] Step 3: Audit producer configs
- [ ] Step 4: Audit consumer configs
- [ ] Step 5: Cross-reference cluster and code configs
- [ ] Step 6: Generate report- 通过Lenses MCP检查实时集群配置
- 扫描代码库中的生产者/消费者配置属性(参考和
references/producer-defaults.md)references/consumer-defaults.md - 审查生产者配置,与推荐值对比
- 审查消费者配置,与推荐值对比
- 交叉对比集群和代码中的配置
- 生成报告,包含当前值、推荐值以及权衡说明
Step 1: Live Cluster Inspection
步骤1:实时集群检查
Use Lenses MCP tools to check cluster-side performance configs:
- - topic-level configs affecting performance (
get_topic,min.insync.replicas,compression.type)max.message.bytes - - broker-level configs (
get_topic_broker_configs,message.max.bytes,replica.fetch.max.bytes)num.io.threads - - message distribution across partitions (detect skew where one partition has significantly more bytes than others)
get_topic_partitions - - message throughput over time to identify bottlenecks or capacity headroom
get_dataset_message_metrics
Expected output: Topic-level performance configs, partition distribution and throughput metrics.
Validation: If MCP calls fail, proceed with codebase-only analysis and note the limitation in the report.
使用Lenses MCP工具检查集群端性能配置:
- - 影响性能的主题级配置(
get_topic、min.insync.replicas、compression.type)max.message.bytes - - 代理级配置(
get_topic_broker_configs、message.max.bytes、replica.fetch.max.bytes)num.io.threads - - 消息在分区中的分布情况(检测是否存在某一分区字节量远高于其他分区的倾斜问题)
get_topic_partitions - - 一段时间内的消息吞吐量,用于识别瓶颈或容量余量
get_dataset_message_metrics
预期输出:主题级性能配置、分区分布情况及吞吐量指标。
验证:若MCP调用失败,则仅基于代码库进行分析,并在报告中注明此限制。
Step 2: Codebase Inspection
步骤2:代码库检查
Search the codebase for Kafka producer and consumer configuration properties. Consult for the full list of producer properties and for consumer properties.
references/producer-defaults.mdreferences/consumer-defaults.mdAlso search for anti-patterns listed in :
references/producer-defaults.md- Synchronous produce calls (,
.get(),.result()after every send)flush() - Missing delivery callbacks / error handlers
- Missing graceful shutdown / rebalance listeners
在代码库中搜索Kafka生产者和消费者配置属性。参考获取完整的生产者属性列表,参考获取消费者属性列表。
references/producer-defaults.mdreferences/consumer-defaults.md同时搜索中列出的反模式:
references/producer-defaults.md- 同步生产调用(每次发送后调用、
.get()、.result())flush() - 缺失交付回调/错误处理器
- 缺失优雅关闭/重平衡监听器
Step 3: Audit Producer Configs
步骤3:生产者配置审查
Compare found producer configs against the recommended values in . Key areas: , , , , and .
references/producer-defaults.mdacksbatch.sizelinger.mscompression.typeenable.idempotenceretries将找到的生产者配置与中的推荐值对比。重点关注:、、、、和。
references/producer-defaults.mdacksbatch.sizelinger.mscompression.typeenable.idempotenceretriesStep 4: Audit Consumer Configs
步骤4:消费者配置审查
Compare found consumer configs against the recommended values in . Key areas: , , , and .
references/consumer-defaults.mdmax.poll.recordsmax.poll.interval.msauto.offset.resetenable.auto.commitfetch.min.bytes将找到的消费者配置与中的推荐值对比。重点关注:、、、和。
references/consumer-defaults.mdmax.poll.recordsmax.poll.interval.msauto.offset.resetenable.auto.commitfetch.min.bytesSuccess Criteria
成功标准
Quantitative
量化标准
- Triggers on 90% of performance-related queries (test with 10-20 varied phrasings)
- Completes review in under 15 tool calls (MCP + codebase search)
- 0 failed MCP calls per run
- 响应90%的性能相关查询(用10-20种不同表述测试)
- 在15次工具调用内完成审查(MCP + 代码库搜索)
- 每次运行无MCP调用失败
Qualitative
定性标准
- Every finding shows current value, recommended value and trade-off explanation
- Anti-patterns are identified with file and line references
- Estimated throughput impact (low/medium/high) is consistently calibrated
- 每个发现都包含当前值、推荐值及权衡说明
- 反模式标记包含文件和行号引用
- 吞吐量影响评估(低/中/高)保持一致校准
Examples
示例
Example 1: Routine performance review
示例1:常规性能审查
User says: "Review Kafka performance configs for staging"
Actions:
- Inspect cluster-side configs for all topics in staging
- Scan for producer/consumer property definitions
src/ - Cross-reference code configs against reference tables Result: Report with per-property findings and throughput impact estimates
用户提问:"审查 staging 环境的Kafka性能配置"
操作:
- 检查staging环境下所有主题的集群端配置
- 扫描目录中的生产者/消费者属性定义
src/ - 将代码配置与参考表交叉对比 结果:包含各属性发现及吞吐量影响预估的报告
Example 2: Investigating slow consumers
示例2:排查消费者缓慢问题
User says: "Why are my consumers slow? Check the performance settings."
Actions:
- Focus on consumer config properties in the codebase
- Check ,
max.poll.recordsandfetch.min.bytesenable.auto.commit - Look for anti-patterns like synchronous processing Result: Targeted report on consumer-side bottlenecks with remediation steps
用户提问:"为什么我的消费者速度慢?检查一下性能设置。"
操作:
- 重点关注代码库中的消费者配置属性
- 检查、
max.poll.records和fetch.min.bytesenable.auto.commit - 查找同步处理等反模式 结果:针对消费者端瓶颈的定向报告及修复步骤
Example 3: Scoped codebase review
示例3:限定范围的代码库审查
User says: "Check Kafka configs in src/kafka/ for the production environment"
Actions:
- Scan only for producer and consumer configs
src/kafka/ - Cross-reference with live production cluster settings Result: Focused report on a specific directory's Kafka configurations
用户提问:"检查生产环境下src/kafka/目录中的Kafka配置"
操作:
- 仅扫描目录中的生产者和消费者配置
src/kafka/ - 与生产环境实时集群设置交叉对比 结果:针对特定目录Kafka配置的聚焦报告
Troubleshooting
故障排除
No Kafka config properties found in codebase
代码库中未找到Kafka配置属性
Cause: The codebase may use a framework or wrapper that hides raw Kafka properties.
Solution: Search for framework-specific config patterns (e.g., Spring Boot , Django settings). Report the framework used and suggest manual review.
application.yml原因:代码库可能使用了隐藏原始Kafka属性的框架或封装层。
解决方案:搜索框架特定的配置模式(如Spring Boot的、Django设置)。报告使用的框架并建议手动审查。
application.ymlLenses MCP returns no topic data
Lenses MCP未返回主题数据
Cause: Environment name is incorrect or Lenses agent is offline.
Solution: Run first. Verify the environment name matches what returns.
check_environment_healthlist_environments原因:环境名称不正确或Lenses代理离线。
解决方案:先运行。验证环境名称与返回的名称一致。
check_environment_healthlist_environmentsPartition skew detection is inconclusive
分区倾斜检测结果不明确
Cause: Topic has very low throughput so byte counts are similar across partitions.
Solution: Note that skew detection requires meaningful throughput. For low-volume topics, skip the skew check and note it in the report.
原因:主题吞吐量极低,导致各分区字节量相近。
解决方案:注明倾斜检测需要足够的吞吐量。对于低流量主题,跳过倾斜检查并在报告中说明。
Output Format
输出格式
undefinedundefinedPerformance Review Report
Performance Review Report
Cluster-Side Findings
Cluster-Side Findings
- [topic-name] {property}: {current value} Recommendation: {recommended value} - {explanation}
- [topic-name] {property}: {current value} Recommendation: {recommended value} - {explanation}
Codebase Findings (Producers)
Codebase Findings (Producers)
- [file:line] {property} = {current value} Recommendation: {recommended value} - {explanation}
- [file:line] {property} = {current value} Recommendation: {recommended value} - {explanation}
Codebase Findings (Consumers)
Codebase Findings (Consumers)
- [file:line] {property} = {current value} Recommendation: {recommended value} - {explanation}
- [file:line] {property} = {current value} Recommendation: {recommended value} - {explanation}
Anti-Patterns
Anti-Patterns
- [file:line] Description of the anti-pattern Recommendation: How to fix it
- [file:line] Description of the anti-pattern Recommendation: How to fix it
Summary
Summary
- X producer issues found
- Y consumer issues found
- Z anti-patterns found
- Estimated throughput impact: low/medium/high
undefined- X producer issues found
- Y consumer issues found
- Z anti-patterns found
- Estimated throughput impact: low/medium/high
undefined