Jmeter线程真的可以近似用户吗? [英] Does a Jmeter thread really approximate a user?

查看:147
本文介绍了Jmeter线程真的可以近似用户吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用Recording Controller设置JMeter负载测试.

I am trying to setup a JMeter load test, using the Recording Controller.

这将导致网络浏览器进行的所有调用重复-包括css文件,js文件和图像.

This results in duplication of all the calls the web browser would make - including css files, js files and images.

鉴于Web浏览器将同时获取这些请求(并发执行大约10个Web请求). jmeter文档倾向于将1个用户等同于1个线程-但这与现代Web浏览器的工作方式不一致.

Given that a web browser would get these concurrently (performing approximately 10 web requests concurrently). The jmeter documentation tends to equate 1 user to 1 thread - but this does not line up with the way in which modern web browsers work.

设置负载测试时,我需要为每个用户使用10个线程吗?

Do I need to use 10 threads for each user when setting up my load test?

推荐答案

严格来讲,JMeter无法模拟浏览器. JMeter有其自身的局限性,例如不解析.js文件(按照3.0版本),从事件发送ajax请求等.

Strictly Speaking, JMeter can't simulate a browser. JMeter has its own limitations, like not parsing .js files (as per 3.0 version), sending ajax requests from events etc.

但是,对于您的问题,JMeter提供了支持.

But, for your question, there is support in JMeter.

因此,您可以根据需要指定并发池大小,例如将并发池大小值设置为10,这将解决您的问题.

So, you can specify the concurrent pool size as per your requirements, say concurrent pool size value set to 10, which would solve your issue.

今天,浏览器通常同时发送请求,每个浏览器都有自己的最大值,可以同时建立最大连接.

Today browser normally sends requests concurrently and each browser has its own max value for maximum connections that can be made concurrently.

请参考以下链接: 浏览器中的最大并行http连接数?如何在使用时解决Chrome的6个连接限制xhr轮询.

Refer following links: Max parallel http connections in a browser? and How to solve Chrome's 6 connection limit when using xhr polling.

当您使用检索嵌入式资源"并设置并发池大小时,只需添加父采样器即可,它通过Jmeter本身触发诸如.css,.js文件之类的资源请求. (例如:仅添加stackoverflow.com,它将自动加载所有资源,例如.css,.js).在记录过程中,所有这些请求都被单独记录,因此您需要删除所有请求或创建仅包含父采样器的新计划/线程组.

When you use "Retrieve Embedded Resources" and set Concurrent Pool Size, you ONLY need to add parent sampler, which triggers resource requests like .css, .js files by Jmeter itself. (Eg: add only stackoverflow.com and it will load all the resources like .css, .js automatically). During recording , all these requests are seperately recorded, so you need to remove all of them or create a new plan/thread group containing only parent sampler.

注意:正如我提到的那样,不会发送从.js,.csv触发的请求,因为Jmeter不会像浏览器一样解析它们.您只需要显式地将这些请求添加为采样器即可.添加查看结果树",并比较Jmeter和浏览器(F12->网络"选项卡)触发的请求,以了解Jmeter遗漏了哪些请求.

Note: As I mentioned, requests triggered from .js, .csv won't be sent as Jmeter won't parse them like Browser. You need to add ONLY these requests as samplers explicitly. Add View Results Tree and compare the requests triggered by Jmeter and Browser (F12 -> Network tab) to know which request are missing by Jmeter.

这篇关于Jmeter线程真的可以近似用户吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆