In one of the previous posts I presented an improved version of JMeter’s Time vs Threads chart. Now, it’s time to tackle another gap in JMeter’s dashboard graphs: transactions per minute.
You may ask why I need it, since there is a similar chart already available – transactions per second. I have to admit I’m usually keen on pacing the workload using JMeter’s constant throughput timer component (look here and here). And you can only configure it – you guessed it – in occurrences per minute.
One of the first things that I do after a performance test run is checking whether I managed to load the system with the required throughput. As I tend to use separate pacing for each transaction, I used to look at the JMeter’s transactions per second chart and scale the occurrence count from seconds to minutes:
However, that solution obviously sucked, as you should strive to automate such manual work that is susceptible to errors. Therefore, currently I’m generating a chart that immediately shows me the needed throughput information in the correct units:
I generated the graph in R, as it’s a great tool when it comes to statistical analysis and visual presentation.
Generate Transaction per minute chart based on JMeter results by yourself
- Install R
- It’s not necessary, but I recommend to additionally install RStudio – a free IDE for R
- Install needed R packages by running following commands:
install.packages("lubridate") install.packages("ggplot2") install.packages("dplyr")
- Finally run the script (of course you need to provide paths for input .jtl file and output .pdf with a graph + don’t forget to change the line that removes not needed rows from .jtl)
# Load packages library("ggplot2") library("lubridate") library("dplyr") # Load JMeter results data from file jmeter_results <- read.csv("C:\\Path\\To\\JMeter's\\results.jtl",header=T, sep=",") # Add datetime for samples by converting unix epoch timestamp jmeter_results$datetime <- as_datetime(jmeter_results$timeStamp/1000) # Group data and compute the transaction count per minute summarized_jmeter_results <- group_by(jmeter_results,datetime_bucket=floor_date(datetime,"1 minute"),label) %>% summarise(transaction_count=n()) # Remove not needed rows - leave only transaction samples containing in my case a "TR" prefix - NOTE change the regex or comment the line! summarized_jmeter_results <- summarized_jmeter_results[grep("TR", summarized_data$label) ,] # Construct transactions per minute plot plot_tpm <- ggplot(summarized_jmeter_results,aes(x=datetime_bucket,y=transaction_count,colour=label, group=label)) + geom_line(size=1.2) + scale_color_hue(name="Transaction Name",l=70,c=150) + labs(title="Transaction Count per minute",subtitle="Complementary JMeter results graph") + scale_y_continuous("Transaction Count",breaks=0:100*10,minor_breaks=NULL) + scale_x_datetime("Test duration, granularity: 1 minute",date_breaks="10 min",date_labels = "%H:%M") + theme_bw() + theme(axis.line = element_line(size = 2, colour = "grey"),axis.text = element_text(size = rel(1.1)),legend.position = "bottom", title = element_text(size = rel(1.1),face="bold")) print(plot_tpm) # Save the plot to pdf ggsave("C:\\path\\to\\save\\graph.pdf",device="pdf")