3
votes

Since I am a new to Jmeter,I have a little confusion regarding the difference between "Threads" and "Samples" in the Jmeter.

For example Sometimes we have set the "Number of thread" as "200" and run the test in jmeter . We have seen the "samples" as "200" in the summary report.But sometimes for the same threads we are seeing "samples" as "160" or "samples" as "240"in the summary report.Image shows how we have set the threads in jmeter

Can any please explain the difference between threads and samples?Whether samples may differ from the thread?

2

2 Answers

3
votes

Threads and Samples are totally different.

  • Threads represent the number of virtual users.

  • Samples represent the number of total requests made by users.

So suppose if you have a test plan with 5 requests.

If you run it with 1 user : you will have 1 thread and 5 samples. If you run it with 10 users : you will have 10 threads and 50 samples.

Note, that number of threads or samples could vary because of machine/network/server limitations etc.

For example we ask JMeter to create 1000 threads but our machine is able to create only 100 threads at maximum (because of low CPU/ram)

Similarly, number of samples could be less/more because of network failure, test scenario etc.

0
votes

If you have recorded a workflow, and want to run with single user you set the number of Threads as 1.Threads are nothing but # users.

The Samplers are the individual requests. If you group the samplers using "Transaction Controller" by checking "Generate parent Sample" all samplers under that Transaction Controller is treated as Single.