我应该如何对我的 Web 应用程序进行压力测试?
我有一个有点复杂的 Web 应用程序,在客户端包含 Flash 和 javascript,在服务器端包含 PHP 功能。 PHP 功能包含用于使用 gnu 软件(*nix 环境)合并/编辑/创建文件的系统调用 (exec()) 以及用于上传这些文件的 REST 服务的 api 调用(但这将通过 cron 作业完成)。
我们还没有准备好上线,我们预计在启动时会出现大量服务器负载,因此我们需要对环境进行压力测试。我查看了一些库,例如 JMeter,但据我所知,这些库无法处理 Flash - 并且合并/编辑/创建取决于 Flash 应用程序的输入。如何以最佳方式对我的环境进行压力测试?
此致,
I've got a somewhat complex web application, containing Flash and javascript on the client side and PHP functionality server side. The PHP functionality contains system calls (exec()) to merge/edit/create files with gnu software (*nix environment) as well as api calls to REST services for uploading these files (this will be done with cron jobs, however).
We're not ready to go live just yet, we're expecting a large server load directly at launch, so we need to stress test the environment. I've looked in to some libraries, like JMeter, but afaik these libraries cannot handle the Flash - and the merge/edit/create depends on input from the Flash app. How can I stress test my environment in the best possible way?
Best regards,
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
如果您正在运行 Apache,则可以使用
ab
对应用程序的服务器端进行压力测试。Apache HTTP 服务器基准测试工具
但不知道它是否可以处理 Flash 和/或 Javascript。
If you are running Apache, you could use
ab
to stress test the server side of your application.Apache HTTP server benchmarking tool
Don't know if it can handle Flash and/or Javascript though.
正如另一个人所推荐的,Selenium 在这里可能会很好。唯一的问题是,如果您尝试进行压力测试,单个 Selenium 浏览器无法为您提供足够的并发性。
我的公司 BrowserMob 提供基于 Selenium 的负载测试服务,可以生成 100+ 并发的 Selenium脚本访问您的网站。我们还支持使用本机点击的 Flash,这意味着您甚至不需要执行 Gareth 链接到的技巧(尽管建议您如果可以的话)。
尽管如此,仅仅因为您的网站使用 Flash,并不意味着它一定需要真正的浏览器来进行性能测试。如果 Flash 组件使用原始 HTTP,那么像 JMeter 或我公司的“虚拟用户”服务(即:不使用 Selenium)这样的工具可能会起作用。如果它通过 HTTP 使用 AMF,您仍然可以做到,但通常会有点困难。但如果您真的想测试视频流之类的东西,您可能需要更高级一些。
As another person recommended, Selenium could be good here. The only issue is that if you're trying to do stress testing, a single Selenium browser won't drive enough concurrency for you.
My company, BrowserMob, provides Selenium-based load testing services, in which you can generate 100+ concurrent Selenium scripts hitting your site. We also have support for Flash using native clicks, meaning you don't to even do the trick that Gareth linked to (though that's recommended if you can).
That all said, just because your site uses Flash, it doesn't mean it necessarily requires a real browser to do the performance testing. If the Flash component speaks raw HTTP, then a tool like JMeter or my company's "Virtual User" service (ie: doesn't use Selenium) will likely work. If it speaks AMF over HTTP, you can still do it, but it's usually a bit harder. But if you really want to test things like video streaming, you may need to go a bit more advanced.
Selenium 可能是一个不错的选择;它可以很好地处理 AJAX / JavaScript,并且 Adobe 有一个 Selenium 扩展专门用于Flash测试。 Selenium 有一点学习曲线,但非常值得花时间。
Selenium might be a good way to go; it handles AJAX / JavaScript very well, and Adobe has a Selenium extension specifically for Flash testing. Selenium has a bit of a learning curve, but it's well worth the time.
对于后端 PHP,我只是在每个方法上使用计时器,并尝试到处抓取一些毫秒。我不会太担心 PHP。
对于前端压力测试,我会使用 iMacros 之类的工具进行锤击。
更多信息
希望这有帮助。
For the back-end PHP, I'd just use timers on every method and try scrape some milliseconds here and there. I wouldn't worry too much about PHP.
For the front-end stress test, I'd hammer it using something like iMacros.
More info here
Hope this helps.