How to integrate performance testing and continuous profiling for deeper application insights
A key goal of performance testing is to ensure your applications perform well under various levels of load. While critical, these tests are often conducted with minimal insight into why a system performs a certain way during testing. Metrics, logs, and traces may tell part of the story, but can miss the deeper details.
This is where continuous profiling comes in. Profiling provides unparalleled visibility into how your code behaves under load, pinpointing CPU bottlenecks, memory leaks, and inefficient function calls. Without it, you’re essentially running tests blindly, hoping for the best.
Meanwhile, shifting left is a practice that involves addressing issues earlier in the development lifecycle rather than in production. By automatically integrating performance testing with continuous profiling capabilities in your CI/CD pipelines, you can do exactly that: catch performance regressions early, before they impact users.
This is why we’re excited to announce a new integration that lets you easily connect Grafana Cloud k6, the fully managed performance testing platform powered by Grafana k6, and Grafana Cloud Profiles, the hosted continuous profiling tool powered by Grafana Pyroscope. With this integration, you achieve a more detailed and holistic view of performance under load.
Our middleware packages, baked right into many of our SDKs, annotate profiling data with performance test labels, providing additional clarity and context. Let’s take a closer look.
Performance testing examples
Performance testing — and, specifically, a type of performance testing known as load testing — helps organizations ensure their systems can handle expected workloads while maintaining a high-quality user experience. This testing can encompass a wide range of use cases, but here are some common examples of applications that teams might test:
- Streaming platforms before a major live event: Ensure the big game doesn’t crash your servers.
- E-commerce sites ahead of Black Friday: Keep those checkout pages fast and flawless.
- Gaming launches: Prepare for millions of users logging in at the same time.
Performance testing is essential, but it’s only half the battle. Without profiling, you’re missing the deeper insights that explain why your app is struggling.
Why combine performance testing and profiling?
Combining performance testing and profiling data allows you to:
1. Understand code performance in context: When Grafana Cloud k6 sends annotated test data, Pyroscope client-side instrumentation adds labels to your profiling data. This means you can correlate specific test scenarios with CPU bottlenecks, memory spikes, or inefficient function calls.
2. Build confidence in CI/CD: By shifting left and incorporating these practices into your CI/CD pipeline, you’re not just testing functionality — you’re measuring the real-world impact of your code changes. That’s beneficial both for your app and your budget, because you’re identifying inefficiencies earlier in the development cycle and keeping CI runs as efficient as possible.
3. Protect your end users: Under peak conditions, your app’s performance isn’t just about speed; it’s about user trust. By linking performance tests with performance data, you ensure your app delivers an exceptional experience, no matter the load.
How the integration works
The key piece of this integration functions because continuous profiling can dynamically add and remove labels based on HTTP headers. When k6 sends a request to an application instrumented with continuous profiling, middleware will apply the headers of the k6 request as labels for the profiles, which can then be queried and analyzed via the Grafana Cloud k6 or Cloud Profiles UI.
Here’s a breakdown of the steps:
- Run your test in Grafana Cloud k6: Define scenarios and ramp-up periods to mimic real-world traffic patterns.
- Annotate with middleware: Our SDKs automatically tag profiling data with relevant test details.
- Visualize in Grafana Cloud: Use the Grafana Cloud k6 UI to see profiling data directly paired with your test metrics and link back to Grafana Cloud Profiles for deeper analysis.
A quick example: Black Friday readiness
We’ve seen a lot of success from e-commerce companies conducting performance tests before Black Friday to proactively prepare for the influx of traffic.
Now, with this new integration, you can run a Grafana Cloud k6 performance test to simulate peak traffic and discover which parts of your code might be a bottleneck — before it happens at a more critical time.
With this insight, you can optimize your code, ensuring smooth transactions on the busiest shopping day of the year.
Step 1: Run your test in Grafana Cloud k6 with the Grafana Pyroscope package.
Step 2: Apply the Pyroscope k6 middleware in your application.
Step 3: Visualize the results in Grafana Cloud. Schedule and compare test runs, and then view your data in the Grafana Cloud k6 or the Cloud Profiles UI.
Notice how k6-related metadata, such as k6_scenario and k6_test_run_id, has been added as a label on the profiles. These are just two of the more popular ones, but you can add any k6 metadata to be analyzed later.
You can also view the difference between two test runs in Explore Profiles or Grafana Cloud k6.
This allows you to keep a close eye on test performance and compare to previous test runs to see how performance has changed over time.
Link profiles with your performance tests today!
Adding profiling to your performance tests is critical. Shifting left is more than a buzzword — it’s a best practice that saves time, money, and resources for your teams. It takes your organization from just passing tests to delivering exceptional performance under any load.
To learn more about connecting Granfana Cloud k6 and Grafana Cloud Profiles, please reference our technical docs.
Grafana Cloud is the easiest way to get started with continuous profiling, metrics, logs, traces, and dashboards. We have a generous forever-free tier and plans for every use case. Sign up for free now!