JMeter Test Plan

Brief Description on JMeter Test Plan

Test plan as its name suggests, it is a main script element that contains all the required elements to load test with Jmeter. You can see in the tree structure of Jmeter that all the elements are child of the test plan.

  • First of all to open apache load testing tool “JMeter” you need to click on ApacheJMeter.jar file/jmeter.bat file(in case of windows machine) or jmeter.sh(in case of mac or ubuntu).

  • It will open JMeter application with default Test Plan and Workbench already opened.

Below is the description for the elements of the JMeter test plan:-

Name:- Name of the Test Plan

Comments:- Description of Test Plan or any other comments you can add here

User Defined Variables:- It is used to store User Defined Values. It has two columns Name and Values. Name will be used wherever we want to use that value as “$Name”. In below screenshot we have given Parameter URL and declared it’s value www.***.com.

Now we can use this parameter as many times we want using ${URL}.

CheckBoxes:-

  • Run Thread Groups consecutively:- It works when you have more than one thread groups added in your Test Plan

For Example in below screenshot two threads groups(Thread Group A and Thread Group B) are added. In the first one we have checked the Run Thread Groups consecutively label.

After this, when I ran my test we can check in View result tree listeners that after complete running of Thread Group A requests, Thread Group B requests were started running.

In second scenario, we uncheck it and ran our test and check the result is view result tree.

In this, we can see both JMeter Thread groups running in parallel. Which is by default property of JMeter. So use this as you required.

 

  • Run tearDown Thread Groups after shutdown of main threads:- If checked Run tearDown threads then tear down threads will run after shutting down of main threads
    • tearDown Thread Group that can be utilized to perform Post-Test Actions. The behavior of these threads is exactly like a normal Thread Group element. The difference is that these type of threads execute after the test has finished executing its regular Thread Groups. This thread group can be utilized

If selected, the tearDown groups (if any) will be run after graceful shutdown of the main threads. The tearDown threads won’t be run if the test is forcibly stopped. If selected, the tearDown groups (if any) will be run after graceful shutdown of the main threads. The tearDown threads won’t be run if the test is forcibly stopped.

  • Functional Test Mode:- To test your application functionally also, Once it is checked it will save Response data of requests as well. But it will affect the performance of the JMeter also while running the Load test.

Currently it is not functioning properly, but you can do functional testing using configuring listeners also and assertions in JMeter. To do so First you need to add a listener to your Thread group.

In below example I am adding View Result Tree Listener. After that click on Configure button in view Result Tree. Check all fields for which you want save data and click on done. Provide a Filename parameter like “TestPlan.log”

Now run your test and after completion your test a file will be generated in JMeter default location which is /bin directory.

 

 

 

 

And once you open the file you will find all details which you checked to store in the file.

 

Add directory or jar to classpath:-  External Jars which need to include in test can be added here just need to browse and provide the location of file.

 

For example if you want to use groovy in your script for some manipulation then we need provide Groovy Jar to the classpath. So there is two way of doing that

  • First is we can put the Jars in  * JMETER_HOME/lib – used for utility jars * JMETER_HOME/lib/ext – used for JMeter components and add-ons.
  • Second one is give the path of Jar in the test Plan only

Myths About the Performance Testing Results into Bad Development Process

In this post, I am going to talk about the Myths about the performance testing results into bad development process

I originally posted this article on Linkedin with heading “Slow Running Software Applications? Let’s Do Performance Testing”

Performance testing of the software application can help you find the bottlenecks. But wait, when do you think it should be done?

People often think that the Performance Testing comes into picture only once the Application is completely developed.

Well No, this is partially correct, because the Performance Testing done once the application is developed is the final piece of the puzzle. We might have already missed on many things which if done at the time of development would not only deliver a more accurate product but also, would reduce the bug fixing effort towards the end. We can be sure of not missing such important things if we follow a Better Software Development Process.

Now, what is a Better Software Development Process?

  • This brings me to the Retro Approach of Developing the Software Products (unfortunately still followed by masses), where the developers never wanted to step out of their comfort zones hence, used the only technologies and frameworks they were aware of. That could have been fine if followed 8-10 years ago. But, in this era of the rapid increase of user base if we want to develop a robust product we should first do an extensive Proof of Concept (PoC) to understand which is the best technology or framework for the product development.
  • Also, we should not wait to test the product until the development ends instead we should start testing (unit testing, performance testing etc) the product when it is in the development phase to avoid difficulties later.

 

Consider some real world examples of Performance Testing. The reason behind my sticking to Performance Testing is if we do not identify the performance bottlenecks early in the development phase, we might end up paying millions by adding more servers (hardware) to suppress the performance bottleneck but, this too will not prevent the application from crashing.

After observing many different applications, I have found one common reason for performance issues that is true for 90% of the applications.

Let me take two different examples to explain this better.

Example -1 Immature business requirement implementation:

Yes, there are applications which lag even in basic functional/business implementation. I had tested an application which was querying the complete data set of “Sales Order” from the DB2 database by joining all the required tables at the time of page load. This was happening even with no lazy load and with no pagination etc!. This is not it, it will again fetch all Sales order once you create the new sales order.

Why a business user would be interested in viewing like, 3 million records (3-5 years data) every time when they create a new sales order? This was not even restricted to only to the Sales order instead, same was happening with the Invoices, and PO etc.

What will performance testing do in this case? After doing the analysis, we found that a query was taking time and the DB contention was high, but as per the query execution plan, the query was optimized. The problem is with the improper implementation of the business requirement.

Example -2 Lack of understanding on how to use technology:

There are applications built with the technology and framework that are not the best choice for that particular application.

Yes, There are development companies using the technology in which they are comfortable, instead of using the right technology. For instance, very small example, Use of .NET for small static websites with just a contact us form. Simple use of HTML, CSS and Javascript is good. If you think you will be updating the content frequently then, use any CMS like WordPress or Drupal according to the need. Any free CMS will be far better then the small static website written in .Net for that matter.

 

Implications of Retro Approach for Developing the Software Products:

  • You will end up paying millions for hardware resources that will still not solve the performance issues completely.
  • Use of middleware application that will save the data in cache which will again add the cost to the hardware infrastructure plus the cost of the middleware itself
  • Rework on optimizing the code
  • Maintenance cost will be high
  • Threat of application failure because of heavy load

 

Now, How a Good Product Development Cycle Should Look Like

Small tweaks/enhancements in the existing development process will work.

  • Development plan: To create a great product with efficiency, you should create the development plan intelligently to include the required pieces of testing as the part of the development process to eliminate the production and maintenance cost. It should contain the effort for the unit, performance, and security review while developing the application. It should engage the right person at right time.
  • POC of technology and framework before use: Choice of right technology is very important you should understand requirement before choosing the technology stack. This should be done right in the designing phase and review before actual implementation. The best way is to involve the Performance and Security Experts for suggestions and review.
  • Implementation – Review and Profiling of the code: Profiling of code means testing how much RAM and CPU a piece of code is consuming. If there a scope for optimization, then at this stage(while writing the code) will be more efficient. There are many profiling plugins available for free that can be integrated with the IDE like  jvmmonitor, and VisualVM etc. Even a developer can do this job with all those plugins or Performance Tester can help and give suggestions if required.

 

If the development process is tweaked in this way, following will be the benefits:

The above graph depicts two same kinds of projects with different approaches.

Here if you observe the Retro Product Development Cycle (indicated by RED line) took more time to complete the project compare to Improved Product Development Cycle (indicated by GREEN line) though the Retro Approach took less time in initial phases as compared to the Improved approach.

The major reason behind this difference is that in the Improved approach we focus on the POC for selecting the technology, tuning of the Code and DB Queries from the beginning of the project itself. Therefore, unlike Retro approach we were not burdened with an unoptimized product which is difficult to fix.

So, start checking the performance sooner, than later.

Thoughts and comments are very welcomed…

WordPress Server Performance Comparison

Which Server to Choose for WordPress Hosting

Which Server to Choose for WordPress Hosting? If you are a techie who creates websites for your clients or you are creating a website for your own. There is always a confusion while choosing the best hosting for the WordPress website. In this post, we are targeting to solve this confusion.

There are a number of good posts on the internet that tells which hosted WordPress solutions to choose or the best hosting provider for WordPress.
But believing on what is written as a promotional article will not lead anyone anywhere. Let’s dig a little bit to understand what is WordPress, what business you are doing using WordPress. Once we understand these two things, then, choosing cheap and best hosting will be easy.

Keeping the audience in mind, I tried to keep the technical jargon minimal so that it is understandable and beneficial for technical as well as non-technical personnel.

 

You must have read or heard below-mentioned points a number of times, to consider, while purchasing a WordPress hosting:

  1. Best hosting provider for WordPress
  2. Comparison of pricing and features of cheap web hosting for WordPress
  3. Useless plugins to keep the WordPress lightweight
  4. Use of cache / CDN

Those are all good points, but how will you validate? How will you decide which server is good for your WordPress Website or do you need all those things mentioned above or is there anything additional you required?

There are a lot of WordPress shared hosting plans offered by various companies. Use this link for a comparison of WordPress shared hosting plans. As per the comparison, inmotion hosting seems best as it is fast and cheap. You can give it a try.

But my experience is- Shared hosting can not solve the purpose. I will share my case in the post below.

If one wants to do a serious business (example, wants to earn money from a WordPress blog), then shared hosting(from any hosting company) is not an option for him. In the shared hosting plan, there is no guarantee for the website speed or the page speed. You always need minimum website loading speed or website page speed so that you do not lose the visitor. So, we should look for a server that supplies a continuous power to your website unlike shared hosting.

 

In order to get the best cloud hosting for WordPress, Let us answer the two questions we asked you to focus on:

  1. What is WordPress – WordPress is a CMS (Content Management System) written in PHP language used as a blog or company website etc to manage the content
  2. What is your business – As WordPress can be used as a CMS (Content Management System) you can create your company website, blog, news website and eCommerce website etc. Basically, any website where you want a backend system or admin panel using which the content can be managed

 

Depending on the type of website you will decide what servers you should use. For example,

  1. If you have a news website, then you need a different CDN that can serve videos, as News website contains heavy videos
  2. If you have a blog or e-commerce, then it’s expected to have a lot of images for which you can either deploy a separate CDN or if that’s not the case, then SSD would work for you.
  3. In the case of a company website, I believe you are good if you have a decent server with SSD.

 

Now, that is again high level and without proof, Let’s look at the actual case study or actual comparison between different servers to understand how WordPress works, to choose the WordPress hosting.

My first advice is to stop searching for fastest web hosting for WordPress or where to host WordPress because the answer to this really depends on your need.

Slow speed can eat up everything!

  1. You will NOT get the audience even when you have the best content on your blog. Because if any pages are taking longer than few milliseconds to 5 seconds to load, it frustrates the visitor.
  2. Slow speed can affect your SEO as- Slower the speed, lower the rank on google refer this article for details
  3. You could get all other features (like- one click deployment or managed services) on any WordPress hosting provider, but you still have to consider speed test for your website

Let’s take example of this (p3lang.com) blog

Shared Hosting: For the first year, I used shared hosting (which provides one-click deployment and other services like emails service GUI or CPanel to manage the website hosting), but a year later, I realised those services are of no use, Instead, the speed of the website is slow because of which I barely get any users and the Bounce Rate was also high.

VPS Hosting: Then, I moved the blog to a VPS hosting (13K Rs/year) from the shared hosting (3K – 5K Rs/year). After moving the website I ran it for 1 year and with the increase in images and updated versions of WordPress, I started seeing slowness in the website. Now, I started thinking- Where to host the website?, Because the page speed was very low and the response time was between 30 to 60 seconds, which is a LOT!

Performance test: I am a performance engineer by profession, So to understand the problem, I started with a very basic thing- To monitor RAM and CPU usage and monitored it for few days. After looking at the results the problem was clear, the hardware resources in use were not sufficient for my blog. They were consuming all 1 GB of RAM (apache web server was almost consuming 800 MBs of RAM with minimal MPM settings) and 50% of the CPU usage, even when there was barely any user. So it was clear the resources in use were not sufficient and I needed a server upgrade. Also, I looked at y-slow and google page speed and found that contents (like- js, CSS, images) were taking time and that was due to the slow speed of the standard disk. So to summarize, I needed more RAM and a CDN to deliver the content faster.

 

Now upgrading the servers is also a cost consuming task because there is a good cost associated with every increase in the configuration of the hardware. But before proceeding, I should know which server is good for my blog-

  1. Should I upgrade to a VPS with 4 GB RAM with CDN
  2. Or, 8 GB RAM with CDN
  3. Also, do I need a better CPU or not
  4. Or, should I try Nginx instead of Apache web server

 

All these questions can be answered, by classifying them into separate cases and executing them, So as to- test usage performance and, based on the corresponding results of each case, determine which is the best hosting solution. So, I did all these experiments to get the best WordPress hosting for my needs. Let’s see these cases, that will give a good idea to decide which one to choose. And trust me if you want to do a serious business you have to leave “shared hosting” right away! Shared hosting is just good for a newbie to explore stuff or for a single page website visited by the only couple of people in a day.

Skipping “shared hosting” from the 4 cases (that we are going to discuss), let’s jump to the table below.

NOTE: We are using a decent WordPress instance with like 200 images and 10 MBs DB size and the overall size of the website is 300 – 350 MBs

 

Configuration Case – 1 Case – 2 Case – 3 Case – 4
Results / Speed Poor Good Good, similar to Case – 2 Better than

case – 2 & 3

OS CentOS Ubuntu 16.04.1 LTS Ubuntu 16.04.1 LTS Ubuntu 16.04.1 LTS
Server Apache/2.2.15 (Unix) Apache/2.4.18 (Ubuntu) Apache/2.4.18 (Ubuntu) Apache/2.4.18 (Ubuntu)
RAM 1 GB 7 GB 3.5 GB 3.5 GB
CPU 1 core, 1.2 GHz 2 core, 2.4 GHz Intel Xeon E5-2673 v3 (Haswell) processors 1 core, 2.4 GHz Intel Xeon E5-2673 v3 (Haswell) processors 1 core, 2.4 GHz Intel Xeon E5-2673 v3 (Haswell) processors
Storage 50 GB Standard Disk Storage 14 GB SSD 14 GB SSD 14 GB SSD
Page Caching Yes, using WP Super Cache plugin No No Yes
Server/VM Location US East US East US East US
Client Internet Bandwidth Download: 2.8 MBPS

Upload: 4.5 MBPS

Download: 2.73 MBPSUpload: 1.6 MBPS Download: 2.5 MBPSUpload: 1.0 MBPS Download: 5.19 MBPS

Upload: 7.28 MBPS

Expires headers No No No Yes, But left for few
Content Delivery Network (CDN) No No No No
Others Both WordPress and DB are on same VM Both WordPress and DB are on same VM Both WordPress and DB are on same VM Both WordPress and DB are on same VM
RAM utilization reaches to 100% even with minimal transactions RAM was 1 GB out of 7 GB RAM was 1 GB out of 3.5 GB RAM was 1 GB out of 3.5 GB
The CPU utilization reaches to 100% ifWordPress admin panel is used CPU was not utilized more than 2% with the admin panel in use CPU was not utilized more than 4% with the admin panel in use CPU was not utilized more than 4% with the admin panel in use

 

WordPress Server Performance Comparison

WordPress Server Performance Comparison


 

From case 1 to 4, the takeaway is, with 3.5 GB RAM and 1 core 2.4 GHz processor,  I am good to serve 1-2 concurrent visitor (s). If you look at the above graphical representation of the results you could see the response time is least in case -4 and the throughput are maximum that is achieved by enabling the WordPress cache which in turns performed better even with the same hardware as case-3.

There are still some tricks left apart from hardware (seen in above cases) that can still be done to further improve the performance. One of the tricks is using Nginx server instead of Apache server (it magically increases the speed) and there are much more. There is a separate post written discussing further cases. Tune in for the upcoming post.

 

 

JMeter Introduction - free website performance test

Introduction to JMeter

In this introduction to JMeter, we will cover the below topics:

  1. A Brief About  JMeter

  2. Interesting Facts of JMeter

  3. Capabilities of JMeter

  4. Scope of JMeter

  5. Download and Install JMeter

  6. JMeter First Look

JMeter Introduction - free website performance test

 

A Brief About JMeter

Apache JMeter is free and open source Performance testing tool written in Java. Hence, JMeter is one of the tool typically used to do free website performance test to measure the web page performance. The first version of JMeter was introduced in Dec 15, 1998 by Stefano Mazzocchi. It’s a great tool for performance testing and widely used in the market as compared to other performance testing tools.

It can be used for different types of performance test, which includes:

  • Load test
  • Stress test
  • Endurance test
  • Volume test
  • Spike test

 

Interesting Facts of JMeter

  • Open source under GPL license – JMeter built by Apache under GPL compatible license, which makes it free and open source. Without any licensing constraint you can use and tweak it. Due to this companies using JMeter for performance testing has increased the scope of job opportunities.
  • Script without coding it – You will find it interesting that JMeter scripts are platform independent. Scripts are not written in Java or any other language. Instead, scripts are created in XML format, which could easily be transported to any machine.
  • Easy to learn – There are a lot of people having a fear that JMeter is a hard tool to learn, trust me you don’t have to be a superman to learn JMeter. JMeter is actually one of the simplest tools to learn.

 

Capabilities of JMeter

JMeter has all the capabilities of performance testing tool it could create complex scripts, generating huge load or creating reports.

  • Complex scripts made easy with powerful GUI – You can create complex scripts using conditions, looping, validations, logic etc. with a wide range of controllers in JMeter. You could also write custom code within the script if required.
  • Unlimited load generation – You can generate unlimited number of virtual users. But at the same time you have to acquire enough hardware for JMeter to generate virtual users.
  • Extensive reporting metrics – JMeter gives lot of information to evaluate on the performance of the application which includes response time, errors, standard deviation, 90 percentile, throughput, response message, response code and other useful information.
  • Automate multiple protocols – JMeter supports a wide range of protocols like http/https, FTP, REST / SOAP, JDBC, LDAP, JMS, POP3, SMTP, IMAP, TCP, Shell scripts, Java objects etc.
  • Easy to develop JMeter plugins – JMeter allows to add custom features without editing anything in the code but by just creating the custom plugins

 

Scope of Jmeter

Like any other tool, there are some limitations with JMeter as well. Performance testing of below mentioned applications is not possible through JMeter

  • SAP
  • Oracle EBS
  • RDP
  • Desktop applications
  • Citrix
  • Flex

There is a company, Ubikloadpack that gives support to some additional protocols by their paid plugins like FLEX / Adobe AIR, video streaming, GWT Plugin etc.

Though JMeter gives you reporting feature but that is not very rich and interactive as compared to other paid tools, but if you use SAAS service like LoadSkull or Blazemeter you could get nice graphs and interactive reporting.

As JMeter support http and other mostly used protocols. It captures the huge market and services like LoadSkull whichmakes it easy to use by eliminating the limitations of JMeter

 

Let’s download and install JMeter

You can download JMeter directly from Apache JMeter website . Download the binaries Zip file for windows, not the source.

It’s only a few Mbs in size. Once it is downloaded, you just have to unzip it and you are good to go.

NOTE: As JMeter is written in java, you must have Java installed on your machine to run JMeter. In some cases, you may also have to add Java path into environment variables.

One’s it’s done you are good to start with JMeter. JMeter GUI is very easy to use and can easily be learned.

Install Jenkins on Amazon EC2 (Ubuntu Server 14.04 LTS)

Jenkins is a powerful application that allows continuous integration and helps in the continuous delivery of projects, regardless of the platform you are working on. It is an open source tool that can handle any kind of build or continuous integration. You can integrate Jenkins with a number of testing and deployment technologies. In this post, we will explain how you can install Jenkins on an Amazon EC2 (Ubuntu Server 14.04 LTS) Instance.

Assuming that you have already completed the below three steps. If not then you can follow our below posts to complete these prerequisites.

  1. First, create a new Amazon EC2 Instance(Ubuntu Server 14.04 LTS) and setup Security Groups and open up ports 22, 80 and 443.  See Blog: Create a new Instance (Ubuntu 14.04) on AWS EC2 and setup Security Groups
  2. Then connect to your EC2 Instance via SSH. See Blog: Connect to AWS EC2 Instance via Putty/SSH
  3. For Jenkins first, you have Install Java on your Instance.  See Blog: Install OpenJDK 8 on Ubuntu 14.04 LTS

Step 1: Fixing Locales in Ubuntu 14.04 LTS on Amazon EC2

Once, we run the above command you should be able to see the below message on the command interface.

Install Jenkins on Amazon EC2 (Ubuntu Server 14.04 LTS)1

Step 2: The Installation

Now, we’re going to add the repository for the Jenkins package. So, we need to install the public key for the Jenkins repository to tell Ubuntu that this is a trusted repository:

Once, we run the above command you should be able to see the below message on the command interface.

Install Jenkins on Amazon EC2 (Ubuntu Server 14.04 LTS)2

Then, we need to tell Ubuntu where the package repository is. We just add the package repository to the list of repositories:

Once, we run the above command you should be able to see the below message on the command interface.

Install Jenkins on Amazon EC2 (Ubuntu Server 14.04 LTS)3

The best practice is to Update packages first:

Once, we run the above command you should be able to see the below message on the command interface.

Install Jenkins on Amazon EC2 (Ubuntu Server 14.04 LTS)4

Finally, we install Jenkins:

Once, we run the above command you should be able to see the below message on the command interface.

Install Jenkins on Amazon EC2 (Ubuntu Server 14.04 LTS)5

Step 3: Verify Installation

Once, we run the above command you should be able to see the below message on the command interface.

Install Jenkins on Amazon EC2 (Ubuntu Server 14.04 LTS)6

This verifies that Jenkins service has been installed is actually running on httpPort=8080.

The reason for that is that Jenkins package actually created a user called Jenkins on the system that allows Jenkins to be run as an unprivileged user.

We don’t want to run it as a root user for security reasons. Now the unprivileged user can’t start the server on privilege port like HTTP port 80 so, it runs on 8080, on the other hand, we don’t have to specify the port 8080 every time to connect to Jenkins server from a web browser.

So, for what we are going to do is to setup an apache server to send proxy requests from port 80 to our Jenkins server port 8080 for that we have to install and configure Apache web server.

Now, to install and configure Apache Web Server we need to follow the below steps.

Step 4: Installing and Configuring Apache

Install apache2 server

Once, we run the above command you should be able to see the below message on the command interface.

Install Jenkins on Amazon EC2 (Ubuntu Server 14.04 LTS)7

Next command is to enable module proxy

Once, we run the above command you should be able to see the below message on the command interface.

Install Jenkins on Amazon EC2 (Ubuntu Server 14.04 LTS)8

After the above, we need to run the next command to enable module proxy_http

Once, we run the above command you should be able to see the below message on the command interface.

Install Jenkins on Amazon EC2 (Ubuntu Server 14.04 LTS)9

Now configure Apache to proxy the request from port 80 to 8080 to Jenkins server for that you have to paste below configuration in the file. Don’t forget to change your EC2 hostname.

For open ‘jenkins.conf’ file type below command and paste above configuration *Don’t forget to change your EC2 hostname*

Once, we run the above command you should be able to see the below message on the command interface.

Install Jenkins on Amazon EC2 (Ubuntu Server 14.04 LTS)10

Step 5: Enabling jenkins.conf

Once the installation is complete we move on to the configuration of the files.We need to enable our new site that we’ve set up in Apache and reload the apache2 service.

Once, we run the above command you should be able to see the below message on the command interface.

Install Jenkins on Amazon EC2 (Ubuntu Server 14.04 LTS)11

Next command is to restart Apache service

Once, we run the above command you should be able to see the below message on the command interface.

Install Jenkins on Amazon EC2 (Ubuntu Server 14.04 LTS)12

Step 6 : Unlock Jenkins

Access the Jenkins server by web browser then you will see below screen which means you have configured Jenkins properly.

Install Jenkins on Amazon EC2 (Ubuntu Server 14.04 LTS)13

Then the next step is to unlock your Jenkins, for that we need to copy the administrator password from “/var/lib/jenkins/secrets/initialAdminPassword” file we could do that by executing the below command on your EC2 server to copy the password and unlock your Jenkins.

Then you will see the Jenkins dashboard.

Install Jenkins on Amazon EC2 (Ubuntu Server 14.04 LTS)14