我应该在 JMeter 中创建相同的线程组来模拟同时用户 activity 吗?

Should I make identical thread groups in JMeter to simulate simultaneous user activity?

在JMeter中进行负载测试时,是否应该创建多个相同的线程组来模拟多个用户同时在我的网站上执行操作?还是一个线程组里面有多个threads/users就够了吗?

我们可以增加 thread/users 的数量进行模拟,因此无需添加相同的线程

线程组旨在表示 "group" 虚拟用户,由于某种原因,它是 "grouped"。

根据 Thread Group 文档:

A Thread Group defines a pool of users that will execute a particular test case against your server.

所以答案是one thread group with multiple threads/users in it suffice

例如,如果您正在对 Whosebug 进行负载测试,您将拥有以下示例用户组:

  1. 未通过身份验证的用户搜索答案
  2. 经过身份验证的用户提供答案
  3. 经过身份验证的用户提问
  4. 经过身份验证的用户正在撰写评论
  5. 正在注册的新用户

假设以上设置,您将需要 5 个线程组来代表这 5 个不同的虚拟用户组。

也可以通过 Throughput Controller or Switch Controller, see Running JMeter Samplers with Defined Percentage Probability 指南了解更多信息,在同一个线程组中分配用户