You Might Like

Performance Testing Essentials

What is Performance Testing?

This is the non-functional type of testing. The goal of performance testing is to eliminate performance bottlenecks but not to find bugs. Popularly known as “Perf Testing”.

Why do we need it?

Focus here will be to test “Speed”, “Scalability” and “Stability” of the Software. This will give you information about whether to invest money in infrastructure of your application or not?

And by “infrastructure” means the backend servers, api servers, database servers and load balancer if exists.

Types of Performance Testing

  • Load Testing
    • Tests the ability to perform in expected user traffic.
  • Stress Testing
    • Teste the ability to perform under high traffic load.
  • Endurance Testing
    • Tests the ability to perform under expected user traffic over a long period of time.
  • Spike Testing
    • Tests the ability to perform under the sudden spike of traffic created by users.
  • Volume Testing
    • Tests the ability to perform under larger data transitions.

What is JMeter?

Performance Testing

Apache JMeter is a free tool that helps you test how well your website, app, or server performs under stress.

  • You’re one person visiting a website. Everything is fast and smooth.
  • But what if 1,000 people visit at the same time?
  • Will it crash?
  • Will it slow down?
  • Can your server handle the pressure?

Basically it is used for PerfTesting and having said that it is free / open-source and also industry standard, it is best choice for someone who wants to get started with Performance Testing.

Simple working of JMeter Performance Testing

There are so many other reasons for you to learn and start using JMeter…

Why JMeter?

  • JMeter is Open source (free)
  • JMeter is Industry Standard
  • JMeter is built on top of JAVA (it can run in any machine which can run JAVA)
  • By default you’ll get open source license for JMeter
  • It has very friendly GUI
  • It is simple and Lightweight, platform independent
  • It provides easy visualization of reports
  • It is very easy to install
  • It is highly extensible
  • It supports multiple protocols which means it can be used to test API servers

Installation of JMeter

Installation steps of JMeter is described below:

  • Make sure that java is installed in your machine.
    • You can use command ‘java –version” or “java -version” to check that
  • If Java is installed, make sure that it is the latest LTS version by cross verifying from here.
    • If you don’t have JAVA installed, make sure to install the latest LTS version.
    • Installation steps may vary according to your machine (Windows, MAC, Linux)
    • Make sure to set the environment variables for JAVA.
      • If you have used an installer for JAVA, it might have been already set.
      • For windows, you can use a control panel to check that.
      • For mac you can use the “~/.bashrc” file to check that.
      • For Linux you can use the same as mac or issue the command “printenv”
  • Once JAVA is installed, Install JMeter from here
  • No extra steps needed after download, just go inside “bin” folder and run “./jmeter” command. (If in mac on Linux)
    • For windows, there will be a “.bat” file, open that.
  • You’ll have the GUI visible on your screen.
JMeter Default Screen Performance Testing

After installation, you can start using JMeter but you should be aware about basics of JMeter Elements.

Basic JMeter Elements?

Different components of JMeter are called or referred to as “Elements” which can have their own individual purpose.

Thread Group

As the name suggests, It is a group of multiple threads. Each thread represents a virtual user which will mimic traffic of one real user to the server. Now, we can manipulate how much traffic we want to simulate which will directly change the no. of virtual users. 

For e.g. We can simulate the traffic of 50 users (vu = virtual users) which means JMeter will create 50 (vu) threads in our machine to simulate the traffic.

Some might prefer option of installing JMeter to some other virtual machine and doing tests from there because it works by creating threads in the machine from where the tests are being performed and it might be the case that your machine have some hardware/resource limitations for JMeter to run to its full-extent.

E.g. In MAC, ideally for JAVA, creation of 4000 threads is the limitation. So, With JMeter, you cannot test for more traffic than 4k users from MAC. Althaugh this limit can be changed.

Samplers

The thread group will simulate a traffic to servers by making some kind of request for e.g. HTTP, FTP, JDBC, etc. Those requests are called Samplers. Each thread group will use at least one of the types of samplers.

Listeners

Listeners show the results of the test executed. It can show results in many different formats such as Graph, Tree, Table, Logs, etc.

Configuration Elements

The commonly used configurations will be saved here. For e.g. HTTP Request Default which will store the default url for home page.

Later on, we can use that and just mention the page name to send request to that page.

E.x. let home page url be "https://videogeeksnet.in" then we can store it in HTTP Request Default and on subsequent Samplers, I can mention “/about-us” or “/news” to go to "https://videogeeksnet.in/about-us" or "https://videogeeksnet.in/news"

What’s next?

Next steps is to set-up your first JMeter Test using the above basic elements explained. Next blog will contain that content, follow VideoGeeksNet for more updates and amazing content.

Leave a Reply

Your email address will not be published. Required fields are marked *