JMeter - 设置每个服务器的唯一 ID
我正在使用 JMeter 对 SOAP Web 服务进行一些负载测试。目前我正在运行 5 台服务器。我想根据请求来自哪个服务器来区分请求。一种简单的方法是将一些唯一标识符粘贴到注册请求的电子邮件地址字段中。我希望像这样使用主机名或 IP 地址 [电子邮件受保护] / [email protected]
然后,当我的数据库填充在正在测试的服务器上时,我可以看到哪个的服务器已达到服务。
知道最好的解决方案是什么吗?
我已经添加了一个用户参数预处理器,但是这只适用于单个线程,不适用于单个服务器。
谢谢。
编辑
@ar:我在哪里可以找到这些内置函数的参考?另外,知道我如何为用户参数做这样的事情:
Name: User_1:
emailPrefix ${__Random(1, 100000, emailPrefix)}
email ${__machineName}_${emailPrefix}_${counter}@domain.com
我想设置电子邮件,这样我就可以在一堆不同的请求中使用它,例如 ${email}。现在它只是最终成为 myMachineName_${emailPrefx}_{$counter}@domain.com
而不是进行替换。
编辑2
我找到了参考。
我得到了问题的第二部分。我刚用过这个
Name: User_1:
email ${__machineName}_${__Random(1, 100000)}_${counter}@domain.com
I am using JMeter to do some load testing on a SOAP webservice. Currently I am running 5 servers. I would like to distinguish the requests based on which server the request came from. An easy way to do this would be to stick some unique identifier into the email address field for a register request. I was hoping to use hostname or ip address like so
[email protected] / [email protected]
Then, as my database is populated on the server being tested, I can see which of the servers have hit the service.
Any idea what the best solution would be?
I have already added a User Paramaters pre-processor, however that only applies to individual threads, not individual servers.
Thanks.
EDIT
@ar: Where can I find a reference to those built-ins? Also, any idea how I would do something like this for a user paramater:
Name: User_1:
emailPrefix ${__Random(1, 100000, emailPrefix)}
email ${__machineName}_${emailPrefix}_${counter}@domain.com
I want to set email so I can use it in a bunch of different requests like ${email}. Right now it just ends up being myMachineName_${emailPrefx}_{$counter}@domain.com
rather than doing the replacement.
EDIT 2
I found the reference.
I got the second part of my question. I just used this
Name: User_1:
email ${__machineName}_${__Random(1, 100000)}_${counter}@domain.com
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以在脚本中使用
${__machineName}
。这将被 JMeter 替换为其运行的计算机的主机名。You can use
${__machineName}
in your script. This will get replaced by JMeter with the hostname of the machine it is running on.