问题
Number of Threads (users): 10 Ramp-up Period (in seconds): 1 Loop Count : 2
Result - When I ran the test it shows 40 samples rather expected count was 20 . I want to ask what could be the reason behind 40 samples .
Number of Threads (users): 10 Ramp-up Period (in seconds): 1 Loop Count : 1
Result - When I ran the test it shows 20 samples rather expected count was 10 .
Error - I tried to compute but I can't understand how it is doubling the user count every time
回答1:
It just means that every your thread sends 2 requests instead of 1 expected. If you use HTTP Request sampler, then I can bet that you have "Follow Redirects" option enabled and send requests to resource that answers with 3xx response code. Adding some listeners like View Results in Tree/Table to your Test Plan (on debugging phase at least) would be a good idea. It really helps to check what exactly Jmeter sends/receives.
UPDATE: Response with 301 response code is a recommendation for your client (browser, jmeter, etc) to move to resource defined by "Location: " response header. So, all popular browsers (and Jmeter by default) automatically forward to this location. That's exactly your "doubled" request. If responses with 301 code is really your case, then you can do one of two things: 1. Disable "Follow Redirects" checkbox that displayed in Jmeter HTTP Request sampler settings right under the input where you enter Path:
But in this case you'll request not the destination page that originally displayed for this URL in your browser, because 301 responses don't contain body, only headers.
- Request not the original URL that answers with 301 code but the final location instead (check your response headers and find the value in Location header).
2nd option is better (by my mind) as it produces a load to an object you really expect. But, of course, it depends on your goals.
来源:https://stackoverflow.com/questions/35201923/query-related-to-no-of-samples-in-summary-report-of-jmeter