Before we start to do performance testing, I think we should know the benefits of performance testing and why we should do performance testing?
User-centric. Almost developers will answer this. Yeah, that's a right answer. But actually, performance testing is not only about user satisfies, but also have more meaning in the term of business. With performance testing, we can find out the list of the risks related to expenses, reducing the cost, continuity, and even for company reputation. With performance testing, you can also identify the bottleneck in your application and of course, you can make a decision based on performance testing to scaling up your application.
Now you got it? You can do much things with performance testing. Now let's go to do some simple performance test using Apache JMeter.
Apache JMeter is an open source Java application which have main functionality for performance measurement and behavioral testing. In this article, I'll share you how to do simple testing with JMeter.
If you are using a mac, you can install it using brew:
brew install jmeter
then you can run with
jmeter command in terminal
1. Create a New Thread Group
2. Setup the thread group as you want.
I think it's clear enough for
Number of Thread (users), right? But quite different with second field, called
Ramp-Up Periods (in seconds). For easy to understand related those two field i give you some examples:
100 threads and 100 seconds ramp-up
it means we will create 100 threads in 100 seconds, so 1 thread will be created for 1 second. More example
100 threads and 50 seconds ramp-up
We will create 100 threads in 50 seconds, so each second will create 2 threads.
100 threads and 200 seconds ramp-up
Means every 2 second will create 1 thread.
3. Add HTTP Request Default
Fill in the protocol (if you are using HTTPS) and server name (ex: awcodify.com)
4. Add HTTP Request Sampler on Thread Group
Add your site path in
Path field. Example:
So, it means you will do GET request to https://awcodify.com/force-redirect-http-to-https-using-load-balancer/
5. Add Some Reports Graph
- Right-click on Test plan -> Listeners -> View Result Tree
- Right-click on Test plan -> Listeners -> Summary Reports
- Right-click on Test plan -> Listeners -> Aggregated Reports
In next section, i'll share how to read the report and make an analysis for your web performance.
6. Run The Test!
You can run the test with clicking the
Run button or just