如何进行 Ruby on Rails 并发测试?
使用 ruby on Rails 3 进行并发测试的最佳方法是什么?我的网站上有很多竞争条件,目前测试它们是一门不精确的科学,非常耗时。
预先感谢您的任何回复。
What is the best way to do concurrency testing with ruby on rails 3? I have many race conditions on my site and currently testing them is a inexact science that is very time consuming.
Thanks in advance for any responses.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我相信 Tourbus 可以提供帮助。
I believe that Tourbus can help.
我最近发布了一篇文章,其中包含有关如何测试作业队列工作人员引起的并发性以验证竞争条件的代码修复的解决方案。它应该适用于 Rails 中的其他并发问题。
http://ternarylabs.com/2012/ 04/16/handle-job-queue-workers-concurrency-in-rails/
I recently published a post with a solution on how to test concurrency caused by job queue workers in order to validate code fix for race condition. It should apply to other concurrency issues in Rails.
http://ternarylabs.com/2012/04/16/handle-job-queue-workers-concurrency-in-rails/
我会考虑使用 Apache Bench 工具。它应该随 Apache 安装一起安装。尽管它是由 Apache 编写的,但它足够通用,可以测试任何类型的服务器。
用法与此类似
<代码>
ab -c 1000 -n 10000 http://www.some-site.cc/
“c”是并发连接数,“n”是请求数。请参阅http://httpd.apache.org/docs/2.0/programs/ab。 html
I would look at using the Apache Bench tool. It should come installed with an Apache installation. Even though it's written by Apache, it is generic enough to test any type of server.
Usage is similar to this
ab -c 1000 -n 10000 http://www.some-site.cc/
The "c" is number of concurrent connections and "n" is number of requests. See http://httpd.apache.org/docs/2.0/programs/ab.html
这篇博文提供了一些您可以使用的有趣解决方案:
http://blog.ardes.com/2006/12/12/testing-concurrency-in-rails-using-fork
This blog post has some interesting solutions you may use:
http://blog.ardes.com/2006/12/12/testing-concurrency-in-rails-using-fork