Rails App/webserver benchmarking - ruby-on-rails

Does anyone know the best lightweight Rails benchmarking tool?
I need to get performance statistics of the webserver and simulate authentication + page navigation per session. I've been trying to use httperf, but been encountering TamperingWithCookie exception in the application.
Ideally, I'd like to separate the application and database from the webserver benchmarking, but interested to see the results of the combination of these.

You can try Tsung, a distributed load testing tool written in Erlang. It's a general tool but can be easily used with Rails applications. In case you need to simulate different user behavior scenarios as a kind of integration tests, you could also try Webrat.

ruby-prof works well either by you manually hitting your app with a browser, or it can benchmark against tests.
here's a great writeup on how to use it: http://cfis.savagexi.com/2007/07/18/making-rails-go-vroom
and here's where you can download it: http://rubyforge.org/projects/ruby-prof/

It's not the best way, but using a web stress tool like MS WAS has worked in the past to show simple benchmarks.

ab is an Apache tool for benchmarking. Probably won't take care of authentication for you but is dead-simple to use:
ab -n 300 -c 20 http://website.com

Related

Memcached Gui Manager for VPS

I am looking for GUI interface for my web application to see the stats for the memcached. How much memcached is used, How much is free.
It will be great if it can show keys stored in memcache and show the growth of the memcache consumed in form of charts etc
I came to know about one, Buts its in very early development.
Any suggestions?
Good to have:
It will be great if it integrates smoothly with my rails application.
A separate sub-domain will work.
PHP, Python or anything other solution will work
On Heroku I have an another application running and memcache addon provides good enough interface for it. Here is the screenshot.
There are numerous tools doing what you want; a very basic one (single PHP file) is MemachedGUI; a more complex one is phpMemcachedAdmin .
There isn't "one memcached GUI to rule them all"; however, the 2 projects cited above being open source, you should be able to customize them fairly easily to do your bidding (especially with regards to graph etc.).
Do keep in mind that there isn't a way to reliably and comprehensively view all the keys stored in memcached; tools that do display that are using this trick, which is very limited.

Stress-testing using Cucumber

I'm currently writing integration tests for a RoR REST API using cucumber.
I'd also like to stress-test the API and was wondering how I might be able to re-use my cucumber scenarios to do this.
I've used JMeter and httperf before for stress-tests, and of course with both tools had to write or record the tests that I wanted to include in the stress testing. Since I already have the scenarios in Cucumber that I want to test, I'm trying to avoid having to rewrite what would be largely the same scenarios in the stress-testing tool's syntax.
Can anybody recommend a way that I could use my cuke tests for this? Ideally, I'd like to simulate hundreds of concurrent users hitting the API.
You very well may have to create your own load harness. Essentially, you'll need to start up a number of threads, each calling the process to start your scenarios. You will want to have a delay to stagger when each thread starts because there will be some overhead involved with loading the Ruby interpreter. You may also have to spread the load across more than one machine for the same reasons. It would probably be best to do this in separate processes. Perhaps this might be good for a new project?
Hmm, what about creating some steps that perform a system call to httpref ?

BDD and API calls you don't want to make during tests

I am working on a Rails app that allows you to create a configuration and then launch a server at EC2 with this configuration.
So far I've been using cucumber for BDD and was very happy with that. However, now I want to pick a configuration and actually launch the server. Due to cost and performance issues I don't want to actually launch a server every time I am running the cucumber features.
Are there any best practices for cases like this? I would like to keep the BDD up, but also don't want to spend too much time on working on an elaborate solution just to have feature descriptions for this. On the other hand I will have the same problems, when I will have to write Unit test for this.
When working on a rails app that required twitter integration, I found fakeweb to be extremely helpful. I've used it in conjunction with cucumber successfully.
I found that to support the BDD outside-in development style, I set fakeweb to disallow all web traffic and then added my faked-out web calls one at a time, as my tests failed. It seemed to fit right in with my BDD workflow.

How can I test if my web application could handle heavy traffic?

What would be a proper way to simulate a large number of requests to test if my web application can handle it?
You could try using Microsoft's WCAT tools. Look here: http://support.microsoft.com/kb/231282
They're free, too. That's always nice.
Depending on your budget, you may be interested in some load testing software designed for this. A Google search brings up all sorts of alternatives. This is probably the best way to do it.
This one has a free trial version and isn't too pricey, but I would recommend shopping around first.
I've used JMeter in the past, and I find it to be very useful for stress/load testing as website, even ones written in ASP.NET (with or without MVC).
In general you would want to (with any tool) write a script of what an average user of your site would do. You may even end up creating multiple of these scripts. Tools like JMeter even allow for a random element to be added to a script. With these scripts created a load testing tool can then simulate as many users as you desire hitting your site.
I would recommend allow JMeter to slowly ramp up the number of concurrent users and watch the response time graph. At the point where the response time starts increasing too highly is at the point where you've hit the maximum number of users (given you scripts) that your site can handle.
ab and httperf are two, more unixy options, if you don't mind delving in that direction.
There's a nice screencast for using httperf by peepcode.
Use the load testing tools from Visual Studio Team System. 2010 if you can get it.
The tools are great to use and provide wonderful instrumentation. There is also a programming model to go with the tools, allowing you to make some very complex testing scenarios possible.
Post the URL on stackoverflow.
Make it sound like a challenge, so lots of people come check it out: "Can you find the hidden performance problem in this app?"

Rails performance analyzers

What are the preffered plugins for monitoring and analyzing the performance of a Rails app? I'm looking for both database/query analyzers and the rest of the stack if possible, though not necessarily all in one plugin. Which ones do you recommend?
( Bonus points for free ones :)
For example, this one looks spify.
RAWK I have used to get performance reports emailed to me at regular intervals. It works by analyzing the rails production logs and has always done well for me.
I recently learned about Scout from their article about rails monitoring, but I haven't had a chance to try it out yet, looks promising!
+1 for new relic.
Also consider five runs, I haven't played with it, but it appears to have a loopback mode for development mode, vs's new relics production mode
Derek here from Scout - we've added deep Rails instrumentation as a plugin. This means you'll get a breakdown of where the request time is spent (db,rendering,other) as well as optimization suggestions for slow MySQL queries.
You can play with the instrumentation on our free plan
Screenshot: http://img.skitch.com/20090513-fe4mnaqn5e7i3nsde5qdwrr6k5.png
This gives info on query analyzers in Rails
http://ronnyml.wordpress.com/2008/07/03/query-analyzer-for-rails/
https://github.com/igorkasyanchuk/rails_performance
I've an own option to monitor performance, it's using Redis to store requests information and not sending data to 3rd party services.
Nothing special, but a simple tool to get the most important reports (rendering time, DB queries, most popular controller#actions)

Resources