How to run 1000 user concurrently using Jmeter and Selenium Webdriver in Junit without causing PC to hang?

huangapple go评论71阅读模式
英文:

How to run 1000 user concurrently using Jmeter and Selenium Webdriver in Junit without causing PC to hang?

问题

我尝试使用Selenium Webdriver在JUnit中同时运行10个用户访问网站,并且因为它同时打开了10个浏览器,导致我的电脑变得很卡顿。我甚至尝试在命令提示符中运行Jmeter,但仍然很卡顿。是否有方法可以实际上同时运行1000个用户而不会让我的电脑负担过重?

英文:

I try to run 10 user accessing a website concurrency by using Selenium Webdriver in JUnit and it caused my PC to lag because it open 10 Browser at the same time. I even tried to run Jmeter in Command Prompt, it is just laggy. Is there any methods to actually run 1000 user concurrently without stressing my PC?

答案1

得分: 2

以下是已翻译的内容:

每个浏览器都有其系统要求,例如对于 Firefox 71,它们是:

  • 512MB RAM / 64位版本需要2GB RAM
  • Pentium 4或更新的处理器,支持SSE2

如果您想启动多个浏览器 - 您需要:

  1. 每个浏览器实例需要2 GB RAM
  2. 每个浏览器实例需要1个CPU核心

对于10个浏览器,您将需要至少11个CPU核心和22 GB RAM,对于1000个浏览器 - 比例更多。

如果您必须使用真实浏览器进行性能测试,您需要选择 分布式测试 并分配足够数量的机器作为负载生成器。请记住,机器不能过载,因为如果它们无法运行足够快 - 您将无法获得准确的结果。

另一个选择是将您的Selenium测试迁移到JMeter,您基本上可以通过JMeter代理 运行您的Selenium测试,因此JMeter将能够捕获相关的 HTTP请求 并将它们转换为 HTTP请求 取样器,或通过 Proxy2JMX Converter 模块的 Taurus 工具重放它们,请查看 将Selenium脚本转换为JMX 文章以获取更多详细信息。

与真实浏览器相比,JMeter的HTTP请求取样器的占用空间非常小,因此您将能够在现代中档笔记本电脑上模拟数千个虚拟用户,前提是您遵循JMeter的最佳实践。

英文:

Each browser has its system requirements, for example for Firefox 71 they are:

  • 512MB of RAM / 2GB of RAM for the 64-bit version
  • Pentium 4 or newer processor that supports SSE2

If you want to kick off several browsers - you need to have:

  1. 2 GB of RAM per browser instance
  2. 1 CPU core per browser instance

For 10 browsers you will need to have 11+ CPU cores and 22+ GB of RAM, for 1000 browsers - proportionally more.

If you have to conduct performance testing using real browsers you will need to go for Distributed Testing and allocate sufficient amount of machines to act as load generators. Remember that machines must not be overloaded as if they will not be able to operate fast enough - you won't get accurate results.

Another option is migrating your Selenium tests to JMeter, you can basically run your Selenium tests through JMeter proxy so JMeter will be able to capture the relevant HTTP requests and convert them into HTTP Request samplers or replay them via Proxy2JMX Converter module of Taurus tool, check out How to Convert Selenium Scripts into the JMX article for more details.

JMeter's HTTP Request samplers have very small footprint comparing to real browsers so you will be able to mimic several thousands of virtual users from a modern mid-range laptop given you follow JMeter Best Practices

huangapple
  • 本文由 发表于 2020年1月6日 15:24:30
  • 转载请务必保留本文链接:https://go.coder-hub.com/59608166.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定