Skip to content

Conversation

emasab
Copy link
Contributor

@emasab emasab commented Oct 8, 2025

measure eachBatch rate, time and lag, avg and max memory usage

@emasab emasab requested review from a team as code owners October 8, 2025 12:35
@Copilot Copilot AI review requested due to automatic review settings October 8, 2025 12:35
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR enhances performance testing capabilities by adding detailed metrics collection including eachBatch processing, memory usage tracking, timing measurements, and offset lag monitoring. The changes consolidate common consumer functionality and expand test coverage to include both eachMessage and eachBatch consumption patterns.

Key changes:

  • Extracted common consumer logic into a shared module supporting both eachMessage and eachBatch patterns
  • Added comprehensive memory tracking with RSS measurements during test execution
  • Enhanced metrics collection including offset lag, processing time, and batch statistics
  • Migrated performance test script from Bash to Node.js for better cross-platform compatibility

Reviewed Changes

Copilot reviewed 7 out of 8 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
examples/performance/performance-primitives-common.js New shared module implementing consumer logic for both eachMessage and eachBatch patterns with enhanced metrics
examples/performance/performance-primitives.js Refactored to use common consumer module with compatibility wrapper
examples/performance/performance-primitives-kafkajs.js Updated to use common consumer module and added duration logging
examples/performance/performance-consolidated.js Added memory tracking, expanded test coverage for both consumption patterns, and enhanced logging
ci/tests/run_perf_test.sh Removed Bash-based performance test script
ci/tests/run_perf_test.js New Node.js-based performance test script with enhanced metric extraction
.semaphore/semaphore.yml Updated to use Node.js performance test script

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines 47 to 46
const outputConfluentProducerConsumer = runCommand('MODE=confluent MESSAGE_COUNT=50000 node performance-consolidated.js --create-topics --consumer --producer');

console.log('Running KafkaJS Producer/Consumer test...');
const outputKjsProducerConsumer = runCommand('MODE=kafkajs MESSAGE_COUNT=50000 node performance-consolidated.js --create-topics --consumer --producer');
Copy link

Copilot AI Oct 8, 2025

Choose a reason for hiding this comment

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

The message count has been reduced from 500000 to 50000 compared to the original bash script. This significant reduction (90%) may affect the reliability of performance measurements and should be documented or reconsidered.

Suggested change
const outputConfluentProducerConsumer = runCommand('MODE=confluent MESSAGE_COUNT=50000 node performance-consolidated.js --create-topics --consumer --producer');
console.log('Running KafkaJS Producer/Consumer test...');
const outputKjsProducerConsumer = runCommand('MODE=kafkajs MESSAGE_COUNT=50000 node performance-consolidated.js --create-topics --consumer --producer');
const outputConfluentProducerConsumer = runCommand('MODE=confluent MESSAGE_COUNT=500000 node performance-consolidated.js --create-topics --consumer --producer');
console.log('Running KafkaJS Producer/Consumer test...');
const outputKjsProducerConsumer = runCommand('MODE=kafkajs MESSAGE_COUNT=500000 node performance-consolidated.js --create-topics --consumer --producer');

Copilot uses AI. Check for mistakes.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it makes the test faster with bigger messages sizes and doesn't seem to affect reliability of results.

@airlock-confluentinc airlock-confluentinc bot force-pushed the dev_performance_test_improvements branch from b8be59f to 99bbb70 Compare October 8, 2025 12:44
@airlock-confluentinc airlock-confluentinc bot force-pushed the dev_performance_test_improvements branch from 99bbb70 to 7cd3c3f Compare October 8, 2025 15:11
@emasab emasab changed the title Performance test improvements, measure eachBatch rate, time and lag, avg and max memory usage Performance test improvements Oct 8, 2025
@sonarqube-confluent

This comment has been minimized.

1 similar comment
@sonarqube-confluent

This comment has been minimized.

Copy link
Contributor

@milindl milindl left a comment

Choose a reason for hiding this comment

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

Thanks for adding the new features to the test (the rss) and eachBatch. The run on semaphore also looks fine to me, as expected in terms of consume throughput and rss.

Copy link
Contributor

@milindl milindl left a comment

Choose a reason for hiding this comment

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

Minor changes suggested

ret = {
...ret,
ssl: parameters.securityProtocol.toLowerCase().includes('ssl'),
sasl: {
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of doing it here, at a later point, do

if (parameters.securityProtocol.toLowerCase().includes('sasl')) {
 ret['sasl'] = { ... };
}

So we can have just ssl. And above && condition can be changed also

Copy link
Contributor

Choose a reason for hiding this comment

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

Same for the confluent performance primitives.

@sonarqube-confluent

This comment has been minimized.

@sonarqube-confluent

This comment has been minimized.

@sonarqube-confluent

This comment has been minimized.

@sonarqube-confluent

This comment has been minimized.

@sonarqube-confluent

This comment has been minimized.

@airlock-confluentinc airlock-confluentinc bot force-pushed the dev_performance_test_improvements branch 3 times, most recently from 421596c to 0d49f6f Compare October 15, 2025 10:04
@airlock-confluentinc airlock-confluentinc bot force-pushed the dev_performance_test_improvements branch 13 times, most recently from a7cb980 to a476f5b Compare October 15, 2025 13:46
@airlock-confluentinc airlock-confluentinc bot force-pushed the dev_performance_test_improvements branch 2 times, most recently from d0899e5 to 54180c9 Compare October 15, 2025 15:26
@sonarqube-confluent
Copy link

Passed

Analysis Details

6 Issues

  • Bug 0 Bugs
  • Vulnerability 4 Vulnerabilities
  • Code Smell 2 Code Smells

Coverage and Duplications

  • Coverage No coverage information (70.80% Estimated after merge)
  • Duplications No duplication information (2.00% Estimated after merge)

Project ID: confluent-kafka-javascript

View in SonarQube

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