检索所有嵌入式资源未下载资源

时间:2019-01-26 12:45:32

标签: jmeter jmeter-plugins jmeter-4.0

我有一个非常简单的Jmeter测试计划,该计划带有一个线程组,并且受基本配置元素支持。 我的HTTP Request Sampler指向应用程序的主页,该主页提供了登录身份验证的功能。

很少要分享的事实

  1. 当我在chrome中访问页面并在chrome开发人员中查看加载时间时,并行下载嵌入式资源将在5秒内完成。

  2. 当我通过jmeter录制相同内容并开始重播时,需要12秒

  3. 下一步,我禁用所有非html资源,并标记主页以下载嵌入式资源。

  4. 启用复选框“使用并行下载下载所有嵌入式资源”复选框并将值设置为6时,jmeter进入挂起状态。

  5. 我认为这可能是Jmeter设置的问题,然后我尝试了www.w3schools.com网站,我能够在主页上进行引用,并且在重放过程中,所有嵌入式资源均已下载。

请帮助我了解我要编写脚本的页面是否涉及任何安全性,无法通过脚本下载并行资源或可能的更正。

可以通过https协议访问该应用程序。

堆转储

"Image Fetcher 0" Id=5734 TIMED_WAITING on java.util.Vector@567840bf
    at java.lang.Object.wait(Native Method)
    -  waiting on java.util.Vector@567840bf
    at sun.awt.image.ImageFetcher.nextImage(Unknown Source)
    at sun.awt.image.ImageFetcher.fetchloop(Unknown Source)
    at sun.awt.image.ImageFetcher.run(Unknown Source)

"ResDownload-Thread-5659" Id=5709 TIMED_WAITING on java.util.concurrent.SynchronousQueue$TransferStack@c26b878
    at sun.misc.Unsafe.park(Native Method)
    -  waiting on java.util.concurrent.SynchronousQueue$TransferStack@c26b878
    at java.util.concurrent.locks.LockSupport.parkNanos(Unknown Source)
    at java.util.concurrent.SynchronousQueue$TransferStack.awaitFulfill(Unknown Source)
    at java.util.concurrent.SynchronousQueue$TransferStack.transfer(Unknown Source)
    at java.util.concurrent.SynchronousQueue.poll(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor.getTask(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    ...

"ResDownload-Thread-5521" Id=5704 TIMED_WAITING on java.util.concurrent.SynchronousQueue$TransferStack@c26b878
    at sun.misc.Unsafe.park(Native Method)
    -  waiting on java.util.concurrent.SynchronousQueue$TransferStack@c26b878
    at java.util.concurrent.locks.LockSupport.parkNanos(Unknown Source)
    at java.util.concurrent.SynchronousQueue$TransferStack.awaitFulfill(Unknown Source)
    at java.util.concurrent.SynchronousQueue$TransferStack.transfer(Unknown Source)
    at java.util.concurrent.SynchronousQueue.poll(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor.getTask(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    ...

"ResDownload-Thread-5545" Id=5703 TIMED_WAITING on java.util.concurrent.SynchronousQueue$TransferStack@c26b878
    at sun.misc.Unsafe.park(Native Method)
    -  waiting on java.util.concurrent.SynchronousQueue$TransferStack@c26b878
    at java.util.concurrent.locks.LockSupport.parkNanos(Unknown Source)
    at java.util.concurrent.SynchronousQueue$TransferStack.awaitFulfill(Unknown Source)
    at java.util.concurrent.SynchronousQueue$TransferStack.transfer(Unknown Source)
    at java.util.concurrent.SynchronousQueue.poll(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor.getTask(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    ...

"ResDownload-Thread-5555" Id=5702 TIMED_WAITING on java.util.concurrent.SynchronousQueue$TransferStack@c26b878
    at sun.misc.Unsafe.park(Native Method)
    -  waiting on java.util.concurrent.SynchronousQueue$TransferStack@c26b878
    at java.util.concurrent.locks.LockSupport.parkNanos(Unknown Source)
    at java.util.concurrent.SynchronousQueue$TransferStack.awaitFulfill(Unknown Source)
    at java.util.concurrent.SynchronousQueue$TransferStack.transfer(Unknown Source)
    at java.util.concurrent.SynchronousQueue.poll(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor.getTask(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)

2 个答案:

答案 0 :(得分:1)

  1. 确保在浏览器开发人员工具中选中Disable cache框:

    enter image description here

    在您的浏览器未发出实际请求并没有从磁盘或内存缓存返回嵌入式资源的情况下

  2. HTTP Cache Manager添加到您的测试计划中以模仿浏览器缓存。
  3. JMeter might fail to recognise certain resources like images embedded in CSS files,因此您可能正遭受JMeter错误的困扰。因此,您可以考虑使用Parallel Controller作为边缘案例的解决方法。

答案 1 :(得分:0)

如果您正在从企业进行测试并拥有企业代理,则可能您正在访问的网站需要一些规则以允许下载所有资源,因此您可能需要调整命令行选项:

另外,请注意,您不应该对应用程序可能正在使用的第三方网站(Google Analytics(分析),跟踪器...)进行负载测试,因此请使用排除模式来忽略它。

您说JMeter挂起,要进行调试,请使用“帮助”>“创建线程转储”并在您的问题中显示输出文件的内容。

我的猜测是它正在尝试建立连接,因为它没有访问权限而挂起,因此您可以在HTTP Request的“高级”标签中进行设置:

  • 连接超时
  • 响应超时

Timeouts configuration