Skip to main content
Case Studies

JMeter in the Pipeline + On-Demand — How to Run Performance Testing Both Automatically and On Command

Organizations that detect performance issues before deployment are up to 70% less likely to experience downtime — this article outlines how to position JMeter in an automated CI/CD pipeline and in on-demand, situation-based testing, along with a 5-level maturity model.

19 Mar 202616 min
JMeterPerformance TestingCI/CD PipelineDevOpsAutomation

Why should performance testing be done both automatically and on demand?

The most common issue in Thai organizations is: "Performance testing only happens after a problem occurs." The system slows down, customers complain, and only then does the team start investigating—only to discover the issue came from code deployed the previous week.

Research across mid-sized and large enterprises shows that teams embedding performance testing into the pipeline can detect regressions 5–10 times faster than teams that test only when issues arise, while also reducing Mean Time to Recovery (MTTR) by more than 60%.

But that does not mean automated testing alone is enough. Some situations require on-demand testing, such as preparing systems before a major campaign or investigating root causes after an incident.

JMeter is a tool that supports both approaches exceptionally well—automated execution in the pipeline and scenario-based execution through a self-service portal.

JMeter Pipeline + On-Demand Testing — Two performance testing approaches


Part 1: JMeter in the CI/CD Pipeline — Automated testing on every deployment

Why embed performance testing in the pipeline?

The idea behind Shift-Left Testing is to move testing as early as possible in the development process. Instead of waiting until staging or production, testing begins as soon as code is pushed to the repository.

The clearest advantage is regression detection—when a developer introduces code that increases response time by 200ms, the system can catch it immediately in the pull request rather than after customers start complaining.

Key benefits of embedding JMeter in the pipeline:

  • Detect performance regressions immediately — no need to wait for manual testing
  • Establish performance standards so every release is validated against the same criteria
  • Reduce the cost of defects — fixing issues in development is 10–100 times less expensive than fixing them in production
  • Build team confidence with every deployment

Integration patterns with major CI/CD platforms

JMeter can integrate with all major CI/CD platforms commonly used in the market. Each platform has different integration methods, with distinct strengths and trade-offs to consider:

GitHub Actions

GitHub Actions is currently one of the most widely adopted platforms. For JMeter-based performance testing, teams can use ready-made actions from the Marketplace or build custom workflows.

A key consideration is the use of self-hosted runners for resource-intensive testing, because GitHub-hosted runners have CPU and memory limitations that can make test results inconsistent.

GitLab CI/CD

GitLab has a strong advantage in artifact management—JMeter test results can be stored as artifacts and easily compared across pipelines. It also includes built-in capabilities for performance testing reports.

Jenkins

Jenkins offers the highest level of flexibility—it includes performance plugins that directly support JMeter and can display response time and throughput trends across hundreds of builds.

One important best practice is that JMeter should run on a Jenkins agent, not on the controller—this follows Jenkins official documentation and prevents load tests from affecting the Jenkins server itself.

Azure DevOps

Microsoft provides Azure Load Testing Service, built specifically to support JMeter. It allows teams to run JMeter test plans directly in the pipeline, with built-in threshold evaluation and automatic quality gates.

For organizations already using Azure, this is often the lowest-complexity option because there is no need to manage load generation infrastructure internally.


Performance Budget & Quality Gate — The criteria that determine whether a build passes or fails

The core of pipeline-based performance testing is the performance budget—predefined thresholds that automatically fail a build if test results exceed acceptable limits.

Below is a recommended minimum performance budget:

Criteria Smoke Test (every PR) Load Test (nightly) Stress Test (weekly)
Response Time (P95) ≤ 500ms ≤ 800ms ≤ 1,500ms
Error Rate 0% ≤ 0.1% ≤ 1%
Throughput ≥ Baseline ≥ Baseline × 80% ≥ Baseline × 50%
CPU Usage ≤ 70% ≤ 80% ≤ 90%

The critical point is to tailor thresholds to the context of each system—an API expected to respond within 200ms should not be judged by the same criteria as a report that takes 5 seconds to generate.

A strong quality gate should not look only at individual values; it should also evaluate change relative to the baseline. For example, if response time increases by 20% compared with the previous build, it should trigger a warning even if it still falls within the threshold.


Test selection strategy by level

Not every test needs to run every time. Choosing the right test for the right context is a critical discipline:

Every Pull Request (Smoke Test):

  • Test only the critical path (login, core data views, primary transaction flow)
  • Use a small number of virtual users (5–10 users)
  • Keep runtime within 2–3 minutes
  • Goal: detect whether new code breaks the system or significantly degrades performance

Nightly Build (Load Test):

  • Test all major business flows
  • Use a number of virtual users aligned with expected production traffic
  • Run for 15–30 minutes
  • Goal: verify that performance remains within defined thresholds

Weekly (Stress/Soak Test):

  • Test maximum system capacity under peak load
  • Use 2–5 times the normal number of virtual users
  • Run for 1–2 hours
  • Goal: identify the breaking point and uncover memory leaks

Result retention and cross-build comparison

Good test results must be stored and comparable—not just marked pass or fail, but tracked over time to show whether performance has improved or degraded over the past 30–90 days.

What should be retained:

  • JMeter HTML Report — stored as an artifact for each build for historical review
  • Summary Metrics — stored in structured form for trend analysis
  • Raw Data — retained for deep analysis when issues occur
  • Comparison Report — automatically generated against the previous build

Good data retention enables teams to answer questions such as "From which release did this API start becoming slower?" in just a few minutes.


Alerting when tests fail

Pipeline-based performance testing is useless if no one knows a test has failed. An effective alerting system should include:

  • Slack / Microsoft Teams — immediate notifications to the engineering channel when the performance gate fails
  • LINE Notify — for Thai teams that primarily use LINE
  • Email Digest — daily summaries for managers and stakeholders
  • Dashboard — real-time visibility into the status of all pipelines

Good alerts must provide enough context—not just "Test Failed," but for example: "Response Time P95 increased from 300ms to 850ms on endpoint /api/checkout starting from commit ABC123."


Artifact and dashboard management

JMeter generates highly detailed reports—HTML dashboards with response time graphs, throughput, error distribution, and much more.

Items that require planning:

  • Retention Policy — how long should reports be kept? We recommend 90 days for summary data and 30 days for full reports
  • Storage Strategy — use CI/CD artifact storage or move reports to object storage
  • Access Control — who needs access to the reports? Developers, QA, managers, or stakeholders
  • Dashboard Integration — consolidate JMeter metrics into the organization’s main dashboards

Part 2: JMeter On-Demand Testing — Testing based on the situation

When is on-demand testing necessary?

While the pipeline covers routine daily testing, some scenarios require purpose-specific testing outside the normal cycle:

Before a major release (Pre-Release)
When launching a new feature with significant architectural impact, testing needs to be more detailed than standard pipeline checks—including edge cases and failure scenarios not covered in nightly tests.

After an incident (Post-Incident)
When the system crashes or slows down enough to affect users, the team must be able to recreate the same conditions immediately to confirm that the implemented fix actually resolves the issue.

Capacity Planning
Before festivals or major campaigns such as 11.11, year-end sales, or back-to-school periods, the team needs to verify whether the system can handle traffic increases of 3–10 times normal volume.

Infrastructure Comparison (Vendor Comparison)
When migrating to a new cloud provider or upgrading servers, the organization must compare whether the new infrastructure genuinely performs better than the current one.


On-demand testing workflows by scenario

Pre-Launch Load Testing

Before launching a campaign or new feature, the workflow should be:

  1. Define the traffic model — estimate concurrent users, usage patterns, and peak periods
  2. Create realistic test scenarios — not just repeated requests to the same URL
  3. Run a baseline test to measure current performance
  4. Run the load test based on the projected traffic model
  5. Run a stress test at 150–200% of projected traffic
  6. Analyze results and tune the system — scale up or out if necessary
  7. Run again to confirm that tuning improvements are effective

Post-Incident Root Cause Analysis

When an incident occurs, JMeter can support analysis with the following process:

  1. Recreate the incident conditions — use real access logs as test input
  2. Gradually increase load until the system begins to fail
  3. Identify the bottleneck — determine which component is the constraint
  4. Test the fix — apply the fix and rerun the same test
  5. Turn the scenario into a regression test and add it to the pipeline

Capacity Planning for Seasonal Traffic

For businesses with seasonal traffic patterns:

  1. Analyze historical data — review traffic patterns from the past 1–2 years
  2. Create a traffic model that reflects real patterns, including ramp-up and ramp-down
  3. Test step by step — normal load → expected peak → 2x peak → 3x peak
  4. Define auto-scaling rules based on test results
  5. Test auto-scaling to confirm it responds quickly enough in practice

Vendor/Infrastructure Comparison

When comparing infrastructure options:

  1. Define a standard test suite to be used across all options
  2. Run the same tests on every infrastructure being evaluated
  3. Collect metrics in a consistent format — response time, throughput, error rate, cost
  4. Create a comparison report showing the pros and cons of each option
  5. Evaluate the cost-performance ratio, not performance alone

Self-Service Testing Portal

As organizations mature, they often find that QA teams and developers want to run performance tests themselves without waiting for the DevOps team—this is where a self-service portal becomes valuable.

A strong self-service portal should provide:

  • An intuitive UI — select the test suite, define virtual users, and run
  • Ready-made templates — preconfigured tests for common scenarios
  • Access control — limit who can run tests, how often, and at what scale
  • Resource guardrails — prevent tests from consuming excessive resources
  • Result history — support historical review and comparison
  • Chat integration — automatically send results to Slack/Teams/LINE

Scheduled Testing — Time-based recurring tests

In addition to pipeline automation and on-demand execution, there is also scheduled testing that runs at fixed intervals:

  • Weekly — comprehensive load tests covering all business flows
  • Monthly — stress and soak tests to uncover memory leaks and connection pool issues
  • Quarterly — full-scale capacity tests to support infrastructure budget planning

Part 3: Recommended architecture and strategy

Performance Testing Pyramid

Just like the general testing pyramid, performance testing also benefits from a pyramid structure:

Base (most frequent): Component-Level Performance Tests

  • Test each API individually
  • Run on every PR
  • Fast, simple, and low cost

Middle: Integration Performance Tests

  • Test end-to-end business flows
  • Run nightly or on every release
  • Moderate execution time

Top (least frequent): Full-Scale Load/Stress Tests

  • Test the full system with production-like traffic
  • Run weekly or before major releases
  • High time and resource requirements

Test environment strategy

The environment used for performance testing has a major impact on result reliability:

Staging Environment

  • Pros: closest to production, real data (anonymized)
  • Cons: high cost, may affect other teams sharing staging
  • Best suited for: full-scale load tests, pre-release testing

Production-Like (Dedicated)

  • Pros: no impact on staging, fully controllable
  • Cons: additional cost, data synchronization must be maintained
  • Best suited for: nightly load tests, capacity planning

Canary / Shadow

  • Pros: allows testing against real production traffic (in shadow mode)
  • Cons: complex setup, requires careful data handling
  • Best suited for: organizations with higher maturity

Test data management

Test data is one of the biggest challenges in performance testing:

  • Data Generation — create test data that reflects real-world patterns in both volume and variety
  • Data Cleanup — clean up data after tests so it does not affect future runs
  • Data Isolation — clearly separate test data from real production data
  • Data Refresh — automatically update test data to align with new schemas

Cost optimization

Running performance tests—especially large-scale load tests—has cost implications that must be considered:

Self-Hosted Load Generator

  • Best suited for: smoke tests and light load tests in the pipeline
  • Advantage: no incremental cost per run
  • Limitation: virtual user capacity depends on hardware

Cloud Load Generator

  • Best suited for: full-scale load tests and stress tests
  • Advantage: virtually unlimited scale, multi-region testing
  • Limitation: cost per execution

Hybrid Approach (Recommended)

  • Use self-hosted infrastructure for daily pipeline tests
  • Use cloud infrastructure for weekly/monthly full-scale tests
  • Reduces cost by 60–70% compared with using cloud for everything

Maturity Model — 5 levels of performance testing

We developed a maturity model to help organizations assess their current state and plan their improvement path:

Level 1: Ad-hoc (Starting Point)

  • Performance testing is done only when problems occur
  • No clear tools or processes are in place
  • Results cannot be compared or reproduced
  • Most organizations are at this level

Level 2: Reactive

  • A tool exists (JMeter), but it is used only upon request
  • Some test scripts exist, but coverage is incomplete
  • No pipeline integration yet
  • Results are starting to be collected, but not systematically

Level 3: Proactive

  • JMeter is integrated into the CI/CD pipeline
  • Performance budgets and quality gates are defined
  • Tests run automatically on every nightly build
  • On-demand workflows exist for special scenarios
  • Trend analysis is beginning

Level 4: Managed

  • Performance testing is part of the Definition of Done
  • Every PR passes a smoke performance test
  • A self-service portal is available
  • Alerting and reporting are automated
  • Teams can make decisions based on data

Level 5: Optimized

  • Performance engineering is embedded in organizational culture
  • AI/ML helps detect anomalies automatically
  • Continuous performance monitoring is active in production
  • Performance SLAs are linked to business KPIs
  • Every architectural decision considers performance impact

Observation: Moving from Level 1 to Level 3 typically takes 3–6 months for organizations with sufficient readiness. Advancing from Level 3 to Level 5 may take 12–18 months.


Pipeline vs On-Demand — Comparing the two approaches

Topic Pipeline (Automated) On-Demand (Manual Trigger)
When it runs Every PR / nightly / weekly When needed
Who triggers it The pipeline automatically QA / Dev / Manager
Test size Small to medium (by pipeline tier) Small to very large (by scenario)
Primary goal Regression detection Investigation / validation
Time required 2 minutes to 1 hour 30 minutes to several hours
Output Automatic pass/fail In-depth analytical report
Cost Low to moderate (frequent runs) Moderate to high (less frequent)
Setup complexity High initially, low afterward Moderate each time
Best suited for Any team with CI/CD Teams needing deep analysis

Short answer: use both—pipeline testing is the daily safety net, while on-demand testing is the deep-dive tool for exceptional situations.


Pipeline Adaptation Guide — Recommendations for organizations getting started

Step 1: Start small

Do not begin with full-scale load testing in the pipeline—start with a simple smoke test that runs in 2–3 minutes, covers 3–5 critical endpoints, and uses 5–10 virtual users.

Once the team starts seeing value from smoke testing, expand into nightly load tests and then weekly stress tests.

Step 2: Choose the right tooling

There are several ways to run JMeter:

  • JMeter CLI — the most basic approach, executed directly from the command line
  • Taurus — a tool that simplifies running JMeter in pipelines, with auto-installation and reporting
  • Managed Services — such as Azure Load Testing or BlazeMeter, which handle the infrastructure for you

The right choice depends on team size, budget, and the CI/CD platform in use—there is no universal answer for every organization.

Step 3: Prepare the infrastructure

Key considerations:

  • Is a self-hosted runner necessary? (Recommended for resource-intensive load tests)
  • Test environment — use staging or create a dedicated environment?
  • Network — the test runner must be able to reach the test environment with low latency
  • Monitoring — server-side metrics must also be observed during tests (CPU, memory, DB connections)

Step 4: Build a performance-first culture

Even the best tools are ineffective if teams do not use them. What helps:

  • Make it as easy as possible — developers should be able to use it without knowing JMeter in depth
  • Present results clearly — dashboards everyone can see and understand
  • Celebrate success — share examples when the team catches regressions before production
  • Do not make it a burden — a 30-minute performance test on every PR will push teams to disable it
  • Educate continuously — run quarterly workshops on performance optimization

Business outcomes organizations achieve

Based on our experience helping Thai organizations build performance testing strategies, organizations that adopt JMeter in both the pipeline and on-demand workflows typically achieve:

  • 60–80% fewer performance-related incidents within 6 months
  • Reduced MTTR (Mean Time to Recovery) from 4–6 hours to 30–60 minutes
  • Greater deployment confidence — teams deploy 3–5 times more frequently
  • 20–30% lower infrastructure costs through data-driven right-sizing
  • Improved user experience — average response times reduced by 40%

Conclusion

Effective performance testing is not about choosing between pipeline and on-demand approaches, but about using both in a complementary way:

  • Pipeline acts as the daily safety net that prevents regressions
  • On-Demand provides the deep-dive capability needed for scenarios requiring more detailed analysis

Most importantly, start small and scale gradually—do not try to do everything at once. Begin with smoke tests in the pipeline, then add complexity as your maturity grows.

If you need guidance in designing a performance testing strategy suited to your organization, the Enersys team has experience helping Thai enterprises progress from Level 1 to Level 5 of the maturity model—feel free to contact us anytime.


Resources

"Empowering Innovation,
Transforming Futures."

Contact us to make your project a reality.