Skip to content

Conversation

@tharindu-nw
Copy link

@tharindu-nw tharindu-nw commented Dec 10, 2025

Purpose

This PR contains k6 load test suite for the Integration Control Plane (ICP) GraphQL API, focusing on read operations performance.

Prerequisites

  1. Install k6:

    # macOS
    brew install k6
    
    # Or download from https://k6.io/docs/getting-started/installation/
  2. Running ICP Server: Ensure the ICP server is running with:

    • Auth service on https://localhost:9445
    • GraphQL service on http://localhost:9446
  3. Test Data: The tests assume you have some existing data. See Generate and Connect to the Test Database for setting up a comprehensive test dataset.

Run All Tests (Default)

cd k6_perf
k6 run load-test.js

Metrics Collected

  • Response Time: p50, p95, p99 percentiles
  • Throughput: Requests per second
  • Error Rate: Failed requests percentage
  • Success Rate: Successful requests percentage
  • Per-Query Metrics: Individual performance for each GraphQL query type

Passing Criteria (Thresholds)

The tests are configured with the following default thresholds:

  • HTTP Request Duration (p95): < 500ms (95% of requests should complete within 500ms)
  • HTTP Request Duration (p99): < 1000ms (99% of requests should complete within 1s)
  • HTTP Request Failed: < 1% (less than 1% error rate)
  • GraphQL Errors: = 0 (no GraphQL-level errors)

What to Look For

  • All checks passing (100% check rate)
  • p95 < 500ms: Fast response times
  • http_req_failed = 0%: No HTTP errors
  • ⚠️ p95 > 500ms: Response times degrading under load
  • http_req_failed > 1%: System errors under load
  • Failing thresholds: Performance doesn't meet criteria

Generate and Connect to the Test Database

  1. Run base schema initialization:

    java -cp ~/.ballerina/repositories/central.ballerina.io/bala/ballerinax/h2.driver/1.2.0/java21/platform/java21/h2-*.jar \
      org.h2.tools.RunScript \
      -url "jdbc:h2:file:./k6_perf/icp_load_test_db;MODE=MySQL;AUTO_SERVER=TRUE" \
      -user sa \
      -script resources/db/init-scripts/h2_init.sql
  2. Populate with load test data:

    java -cp ~/.ballerina/repositories/central.ballerina.io/bala/ballerinax/h2.driver/1.2.0/java21/platform/java21/h2-*.jar \
      org.h2.tools.RunScript \
      -url "jdbc:h2:file:./k6_perf/icp_load_test_db;MODE=MySQL;AUTO_SERVER=TRUE" \
      -user sa \
      -script k6_perf/k6-load-test-data-h2.sql
  3. Update connection manager:
    Edit modules/storage/connection_manager.bal to point to the test database:

    // Change the db client initialization line to:
    self.dbClient = check new jdbc:Client("jdbc:h2:file:./k6_perf/icp_load_test_db;MODE=MySQL;AUTO_SERVER=TRUE", "sa", "");

Note: You can modify k6-load-test-data-h2.sql to generate different data volumes or patterns based on your testing needs.

More details can be found in the README.md

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 10, 2025

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@tharindu-nw tharindu-nw merged commit c4623c8 into wso2:icp2 Dec 16, 2025
3 checks passed
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