References
- Enterprise Java.next: A Slideless Keynote
- A Note On Jakarta EE Testing
- Achieve Quality Code and ROI through Test Automation
- Apache Bench (ab) Kullanarak Bir Web Servisin Yük Testi Nasıl Yapılır?
Testing
- System level -> Regression/System/Stress/Performance testing
- Controller level -> Integration testing
- Service level -> Unit testing
Load and Stress Test
A load test, by definition, measures the performance of a system under an expected load. In contrast, a stress test overloads a system in order to find the breaking point.
A load test is performed in order to ensure that a website or web application is capable of handling specific numbers of users at once. Load Testing is often used in the process of capacity planning, to ensure that a system is able to handle growth to specified levels of simultaneous traffic.
A stress test is used to specifically push a system beyond its intended capacity to identify components that begin to slow down, identify bottlenecks in the system, and bring to light possible points of failure.
- jmeter - Apache JMeter to load test functional behavior and measure performance. One JMeter instance runs for max 800 users.
- loader.io - Loader.io is a FREE load testing service that allows you to stress test your web-apps & apis with thousands of concurrent connections.
- ab - Apache HTTP server benchmarking tool
- BlazeMeter - Continuous Testing platform. Distributed JMeter for stress test. Uses JMeter scripts. Since it is distributed runs multiple JMeter instance.
Example ab
testing for 100 requests with 10 concurrency (clients): We make 100 requests to [url] with 10 concurrency (we can think of it as 10 users making requests at the same time) as follows.
|
|
Example ab
testing for 10 clients 1000 times added header:
|
|
Usually what you get per service at least 4000 transactions per second. 4000-7000 per second per service.
What it means in practice in real world is that application service scalability is never the issue, the problem is always the database.
If the database is not scaled, the more application servers you will start upfront everyone will meet the backend and this usually probably causes problems.
If there is huge number of failed request issue, it is due to dynamic pages. It happens because the Content-Length
can vary between the requests. When using ab
with such pages you need to use the -l
option.
|
|
C10K Problem
example test can be done with
|
|
This runs 10.000 HTTP requests with a concurrency of 16.
Example test results:
|
|
Code Coverage
- JaCoCo - Java Code Coverage Library
|
|
|
|