Reputation: 1875
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.
Upvotes: 14
Views: 4749
Reputation: 61
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/
Upvotes: 2
Reputation: 2765
This blog post has some interesting solutions you may use:
http://blog.ardes.com/2006/12/12/testing-concurrency-in-rails-using-fork
Upvotes: -1
Reputation: 408
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
Upvotes: 1