JMeter - 设置每个服务器的唯一 ID

发布于 2024-08-23 00:23:36 字数 1269 浏览 3 评论 0原文

我正在使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

辞别 2024-08-30 00:23:36

您可以在脚本中使用 ${__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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文