Wednesday 24 April 2013

Performance Testing using Apache JMeter

Apache JMeter is a 100% pure Java desktop application designed to load test client/server software (such as a web application). It may be used to test performance both on static and dynamic resources such as static files, Java Servlets, CGI scripts, Java objects, databases, FTP servers, and more.  JMeter can be used to simulate a heavy load on a server, network or object to test its strength or to analyze overall performance under different load types. 
Requirements

Java Version - JMeter requires a fully compliant JVM 1.4 or higher.
Operating Systems- JMeter is a 100% Java application and should run correctly on any system that has a compliant Java implementation.

Installation & Basic Proxy Instructions

 

To begin using JMeter is to first download the latest production release and install it.
To install a release build, simply unzip the zip/tar file into the directory where you want JMeter to be installed. Provided that you have a JRE/JDK correctly installed and the JAVA_HOME environment variable set, there is nothing more for you to do.
The installation directory structure should look something like this
jakarta-jmeter-2.3.1
jakarta-jmeter-2.3.1/bin
jakarta-jmeter-2.3.1/docs
jakarta-jmeter-2.3.1/extras
jakarta-jmeter-2.3.1/lib/
jakarta-jmeter-2.3.1/lib/ext
jakarta-jmeter-2.3.1/lib/junit
jakarta-jmeter-2.3.1/printable_docs
   Running JMeter 
1. To run JMeter, run the jmeter.bat (for Windows) or JMeter (for UNIX) file. These files are found in the bin directory. After a short pause, the JMeter GUI should appear as shown in Figure.1
 There are some additional scripts in the bin directory that you may find useful. Windows script files (the .CMD files require Win2K or later): 
jmeter.bat - run JMeter (in GUI mode by default) 
jmeter-n.cmd - drop a JMX file on this to run a non-GUI test 
jmeter-n-r.cmd - drop a JMX file on this to run a non-GUI test remotely 
jmeter-t.cmd - drop a JMX file on this to load it in GUI mode 
jmeter-server.bat - start JMeter in server mode
 
2. Right click on the “Test Plan” and add a new thread group: Add > Thread Group
3.  Select the Thread Group
4.  Right click “Add -> Config Element -> HTTP Request Defaults”
5.  In new HTTP Request Defaults element: Server name – enter the testing URL. In our manual it is “jmeter.apache.org”
6. Path – leave blank
7. Next, select WorkBench
8. Right click on WorkBench and add the Http proxy: Add -> Non-Test Elements -> HTTP Proxy Server
9. Right click on “HTTP Proxy Server” and add a listener: Add -> Listener -> View Results Tree
10. Return to HTTP Proxy Server and change the Target Controller path to wherever the execution/recording should take place and click the “Start” button at the bottom
 
Configure your browser to use the JMeter HTTP Proxy
At this point, JMeter's proxy is running. For this exercise, we will use Firefox to view some pages on JMeter.
1. Start Firefox, but do not close JMeter.
2. From the tool bar, click “Edit -> Preferences” (or “Tools > Preferences”). This should bring up the options.
3. Select the “Advanced” tab, and “Network” tab
4. Click “Settings” button near the bottom.
5. On the new popup, check “Manual proxy configuration”. The address and port fields
6. Should be enabled now.
7. Address – enter “localhost” or the IP address of your system
8. Port – enter “8080”.
9. Check “Use this proxy server for all protocols”
10. Click “ok” button
11. Click “ok” button again. This should return you to the browser
 
Record your navigation
1. With your browser, in the “Address” bar at the top, enter “http://jmeter.apache.org/” and hit the “enter” key.
2. Click on a few links on JMeter's pages.
3. Close your browser and bring up the JMeter window.
4. Expand the thread group and there should be several samplers. At this point, the test plan can be saved as is. 
5. Select “Thread Group”
6. Right click “Add -> Listener -> Summary Report” to add a summary listener.
7. The summary listener will show some basic statistics
8. Select “Thread Group”
9. Number of Threads – enter “5”
10. Ramp up Period – do not change
11. Loop Count – enter 10
 
Start the test
At this point, we are ready to run our test plan and see what happens. Save the test plan with .jmx extension 
 
When you're ready to run the test, there's two ways:
1. Run -> Start
2. Ctrl–R 
 
As the test runs, the statistics will change until the test is done. At the end of the test, the summary report should look like this.

No comments:

Salesforce AI Associate Certification - 3

What is semantic retrieval in the context of LLMs?   Searching for relevant information in other data sources What additional protection do...