Jmeter Latency, Sample Time and 302s

Performance Testers Diary

Jmeter Results Table

When looking at the difference between sample time and latency in Jmeter, I have always used the following definitions:

Sample Time : Time from invoking the request to the last byte of the response coming back

Latency: Time from invoking the request to the first part (packet) of the response returning.

To confirm the above defintion I used the network sniffer wireshark while executing a simple Jmeter script for a single request to a web page. Using the network sniffer I can identify when Jmeter makes the first request for the webpage which typically includes opening a TCP/IP connection. I can then see when the first packet of the response arrive at the workstation and the last packet of the response arrives at the workstation. This allows me to build a driagram below to confirm the definitions above plus/minus a few milliseconds.

jmeter network flow

However, what happens when you have a page…

View original post 60 more words


Howto debug JMeter scripts

In this article we examine debugging options in JMeter. I start from debugging on GUI level which helps during working with “Post Processors”. In this case we will debug “Regular Expression Extractor”. To make it work, add these elements into test tree:

    • Thread group
      • HTTP Request
        • Regular Expression Extractor
      • Debug Sampler
      • View Results Tree

Now you have to configure “HTTP Request” and “Regular Expression Extractor” and the rest of elements leave unchanged. Insert any server name, for example releasecon.wordpress.com in “HTTP Request”. “Regular Expression Extractor” should be changed proceeding screenshot.


Now try to run your test, open “View Results Tree” and select “Debug Sampler”. On the right pane you see the list of Jmeter variables and also REGEXP variable with value.


Tips to debug manually with Debug Sampler

  • Disable all unused elements in test tree, as it will take too much time
  • Set all Thread properties values to 1
  • Click Ctrl+E and Ctrl+R – to keep results tree clean

Jmeter Debug logging

 Debug logging can provide more detailed information. By default you can debug any package and any class. So I showed howto debug “Regular Expression Extractor” with Debug Sampler and now I will show howto debug “Regular Expression Extractor” with debug logging. First you need change jmeter.properties and set jmeter.loggerpanel.display=true. After save your script and restart Jmeter. When Jmeter launches you will see log panel.


Open your previous script, select “Regular Expression Extractor” from test tree and click Ctrl+W. In log panel you see two new strings, this is classpath of “Regular Expression Extractor” processor.


 Now open jmeter.properties and add line in “Logging Configuration” label:


Restart Jmeter, open your script and try to run it. If you see DEBUG – jmeter.extractor.RegexExtractor message this means debug logging working and you can scroll up to see HTML body, “Regular Expression Extractor” settings.


It’s not recommended to use such way to debug Regexp patterns, it was just example. But debugging protocols such as HTTP, FTP, JDBC, JAVA wil be very useful, to achieve this just uncomment needed packages in jmeter.properties and change value to DEBUG. For example:


Howto debug Beanshell in Jmeter

When you use Beanshell in your script it maybe difficult to debug it in Jmeter. You can enable Beanshell debug logging with adding log_level.jmeter.testbeans=DEBUG in jmeter.properties.

As result you will get detailed debug information but Jmeter is not IDE and sure not good choice for debugging Beanshell scripts. I decided that best option to debug Beanshell is using native console in standalone mode. Let’s create simple beanshell and lauch it.

$vim helloWorld.bsh

Add this code:

helloWorld() {

System.out.println("Hello World!");


Export Beanshell classpath to use it in console.

export CLASSPATH=$CLASSPATH:bsh-xx.jar

bsh-xx.jar can be found in lib folder of Jmeter.

Run your script:

java bsh.Interpreter helloWorld.bsh

If you get error similar to this:

Evaluation Error: Sourced file: helloWorld.bsh Token Parsing Error: Lexical error at line 5, column 24. Encountered: "\u201c" (8220), after : "":

To fix it change curly quote to simple.

To debug this code add to the first line code:


and you code will look like this:

helloWorld() {    System.out.println("Hello World!");

Run your code:

 bsh.Interpreter helloWorld.bsh


// Debug: invokeLocalMethod: helloWorld
// Debug: trying to resolve variable: System
// Debug: trying class: System.out
// Debug: Trying to load class: System
// Debug: getClass(): System not	found in NameSpace: helloWorld (bsh.NameSpace@771c8a71) (method) 
// Debug: Trying to load class: java.lang.System
// Debug: Name call to getStaticFieldValue, class: class java.lang.System, field:out
// Debug: getResolvedMethod cache MISS: class java.io.PrintStream - println
// Debug: Searching for method: println( java.lang.String ) in 'java.io.PrintStream'
// Debug: Looking for most specific method: println
// Debug: cacheResolvedMethod putting: class java.io.PrintStream public void java.io.PrintStream.println(java.lang.String)
// Debug: Invoking method (entry): public void java.io.PrintStream.println(java.lang.String) with args:
// Debug: args[0] = Hello World! type = class java.lang.String
// Debug: Invoking method (after massaging values): public void java.io.PrintStream.println(java.lang.String) with args:
// Debug: args[0] = Hello World! type = class java.lang.String
Hello World!
// Debug: End of File!

Original article is located here.