jmeter多用户问题
我们正在使用 Jmeter 来测试在 Apache 2 Web 服务器上运行的 Php 应用程序。我可以加载 Jmeter 以使用 25 或 50 个线程,并且服务器上的负载不会增加,但服务器的响应时间会增加。线程越多,响应时间越慢。 Jmeter 或 Apache 似乎正在对请求进行排队。我已经更改了 apache Web 服务器配置文件中的 maxclients 值,但这并没有改变问题。当 Jmeter 运行时,我可以使用该应用程序并获得可观的响应时间。什么给?我希望能够通过增加线程数将我的服务器空闲率降低到 0%。谁能帮我指出正确的方向?
更新:我发现,如果我从应用程序中删除会话,我就能够模拟服务器上的完整负载。我尝试重新启用会话并为每个线程使用 HTTP Cookie 管理器,但它似乎没有产生影响。
We are using Jmeter to test our Php application running on the Apache 2 web server. I can load up Jmeter to use 25 or 50 threads and the load on the server does not increase, however the response time from the server does. The more threads the slower the response time. It seems like Jmeter or Apache is queuing the requests. I have changed the maxclients value in apache web server configuration file, but this does not change the problem. While Jmeter is running I can use the application and get respectable response times. What gives? I would expect to be able to tax my server down to 0% idle by increase the number of threads. Can anyone help point me in the right direction?
Update: I found that if I remove sessions from my application I am able to simulate a full load on the server. I have tried to re-enable sessions and use an HTTP Cookie Manager for each thread, but it does not seem to make an impact.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您需要确定瓶颈发生的位置,然后尝试修复问题。
最后,特别针对您的问题,突出的一件事是可以将大量会话文件存储在单个目录中。 PHP 通常将会话信息存储在文件中。如果该目录变大,PHP 查找会话所需的时间就会越来越长。如果您运行测试时将 cookie 关闭,则 PHP 应用程序可能会为每个用户请求创建数千个会话文件。在 Windows 服务器上,速度会比在 UNIX 服务器上更快,这是由于两个操作系统上目录存储方式的差异造成的。
You need to identify where the bottleneck is occurring, and then attempt to remediate the problem.
Lastly, specifically to your question, the one thing that stands out is it's possible to have a huge number of session files stored in a single directory. Often PHP stores session information in files. If this directory gets large, it will take increasingly long amount of time for PHP to find the session. If you ran your test will cookies turned off, the PHP app may have created thousands of session files for each user request. On a Windows server, it will slow down faster than on a unix server, do to differences in the way directories are stored on the two operating systems.
您是否使用恒定吞吐量计时器?如果 Jmeter 无法通过分配给它的线程来提供吞吐量,您将在响应时间中看到这种排队和井喷现象。要确定这是否是问题所在,请尝试添加更多线程。
我还发现了一份关于脚本内有 javascript 调用时发生这种情况的报告。在这种情况下,尝试将 javascript 调用移至脚本顶部的测试计划元素,或寻找预先计算该值的方法。
Are you using a constant throughput timer? If Jmeter can't service the throughput with the threads allocated to it, you'll see this queueing and blowouts in the response time. To figure out if this is the problem, try adding more threads.
I also found a report of this happening when there are javascript calls inside the script. In this instance, try to move javascript calls to the test plan element at the top of the script, or look for ways to pre-calculate the value.
尝试检查由 apache 而不是 PHP 提供的静态文件,看看问题是否出在 Apache 配置或 PHP 配置中。
另请检查您的网络连接和配置。我们的 JMeter 测试进展顺利,直到碰壁。最终意识到我们只有 100Mb 连接并且已经饱和,需要千兆位修复它。您的网卡或交换机的运行速度可能比您想象的要低,尤其是当它们的速度设置为“自动”时。
Try checking a static file served by apache and not by PHP to see if the problem is in the Apache config or the PHP config.
Also check your network connections and configuration. Our JMeter testing was progressing nicely until it hit a wall. Eventually realized we only had a 100Mb connection and it was saturated, going to gigabit fixed it. Your network cards or switch may be running at a lower speed than you think, especially if their speed setting is "auto".