# Towards Continuous Performance Regression Testing

DevFeed: [Towards Continuous Performance Regression Testing](<https://devfeed.tech/articles/towards-continuous-performance-regression-testing-18884.md>)

Original publisher: [Read original article](<https://www.morling.dev/blog/towards-continuous-performance-regression-testing/>)

Published: 2020-12-16T16:45:00Z

Content type: tutorial

Language: en

Sources: [Gunnar Morling](<https://devfeed.tech/sources/gunnar-morling.md>)

Topics: [Testing](<https://devfeed.tech/topics/testing.md>), [JDK Flight Recorder](<https://devfeed.tech/topics/jdk-flight-recorder.md>), [Development](<https://devfeed.tech/topics/development.md>), [SQL](<https://devfeed.tech/topics/sql.md>), [Databases](<https://devfeed.tech/topics/databases.md>)

Tags: [ci](<https://devfeed.tech/tags/ci.md>), [database](<https://devfeed.tech/tags/database.md>), [functional](<https://devfeed.tech/tags/functional.md>), [jdk-flight-recorder](<https://devfeed.tech/tags/jdk-flight-recorder.md>), [latency](<https://devfeed.tech/tags/latency.md>), [metrics](<https://devfeed.tech/tags/metrics.md>), [orm](<https://devfeed.tech/tags/orm.md>), [performance](<https://devfeed.tech/tags/performance.md>), [regression](<https://devfeed.tech/tags/regression.md>), [sql](<https://devfeed.tech/tags/sql.md>), [testing](<https://devfeed.tech/tags/testing.md>)

## AI overview

This article introduces JfrUnit, an open-source project for continuous performance regression testing. It explains how JfrUnit asserts expected values for indirect performance metrics such as memory allocation, database I/O, and executed SQL statements, using events from JDK Flight Recorder. These assertions can identify potential regressions in standard JUnit tests without relying on wall-clock time or production-like hardware.

## Source excerpt

Table of Contents Getting Started With JfrUnit Case Study 1: Spotting Increased Memory Allocation Case Study 2: Identifying Increased I/O With the Database Discussion Summary and Outlook Functional unit and integration tests are a standard tool of any software development organization, helping not only to ensure correctness of newly implemented code, but also to identify regressions -- bugs in existing functionality introduced by a code change. The situation looks different though when it comes to regressions related to non-functional requirements, in particular performance-related ones: How to detect increased response times in a web application? How to identify decreased throughput? These aspects are typically hard to test in an automated and reliable way in the development workflow, as they are dependent on the underlying hardware and the workload of an application. For instance assertions on the duration of specific requests of a web application typically cannot be run in a meaningful way on a developer laptop, which differs from the actual production hardware (ironically, nowadays both is an option, the developer laptop being less or more powerful than the actual production environment). When run in a virtualized or containerized CI environment, such tests are prone to severe measurement distortions due to concurrent load of other applications and jobs. This post introduces the JfrUnit open-source project, which offers a fresh angle to this topic by supporting assertions not on metrics like latency/throughput themselves, but on indirect metrics which may impact those. JfrUnit allows you define expected values for metrics such as memory allocation, database I/O, or number of executed SQL statements, for a given workload and asserts the actual metrics values -- which are obtained from JDK Flight Recorder events -- against these expected values. Starting off from a defined base line, future failures of such assertions are an indicator for potential performance regres