Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails 3 application, how to measure stability under high loads

Hi I'm a new programmer and I've been working on my first real application that I'm going to launch in the coming weeks. The app uses some neat ideas around photo sharing, but basically is just a photo sharing web app. I'd like to find information out about what type of loads a small rails 3 application can handle but I'm not sure where to start. Do I need to run benchmarking tests to find how many requests it can handle and how fast it does this? How does one find statistics like this for their application?

Ultimately I'd like an idea of the maximum amount of traffic the site could handle, or could someday handle, to get my barings down with what I'm working with. I wouldn't want to set in motion a viral marketing campaign if the site couldn't handle over a few hundred concurrent requests. I'm not trying to jump the gun and prepare for a ton of traffic that I don't have yet, but I really would like to have some understanding and an idea of where to go next in terms how the usability and scalability of my application.

Thanks a lot!

like image 909
trying_hal9000 Avatar asked Sep 22 '11 19:09

trying_hal9000


2 Answers

The bigger question here is where are you deploying your application:

I host some of mine on a linode instance, using nginx / unicorn. It's substantially more work but I like it. I don't bother load testing much but sometimes I hit the home pages hard with Siege (you can install it with homebrew, brew install siege) to get a feel of what I am working with.

While on the subject of deploying, I would think getting paid hosting from Heroku would eleviate some of your concerns about stability, upgrading your app settings to survive bigger loads.

Can you give us more information on your hosting choices?

like image 94
Hugo Avatar answered Oct 24 '22 05:10

Hugo


"what type of loads a xxxx application can handle"

You are correct. To answer this, we test!

Without testing, we can't simply say something as broad as our ruby application, running on 2 dyno's from heroku, can handle 100 requests/sec, or 100 concurrent users. We need to test. Scaling can also be a tricky business. Without testing, we won't know which components scale well, and which ones won't.

To get started, we have our application, the system under test. We are already running on Heroku, which gives us immediate access to the New Relic add on. We could try turning on the free version of New Relic to see what information it gives us. There is a pay version we could also try out during our 'tuning sessions' if we need to dive further.

Then we are just missing the 'driver', the process that will drive load against the application, using the most common process flows (uploading images, browsing images, logging in, etc).

To get started, we just need 1-N of our closest friends willing to act as users on our site while we monitor all the activity from New Relic. Measuring response times for user experiences, identifying slow running queries, see where our application is spending its time.

When we get tired of buying our friends all the beer for helping us we can look at automating some those common business flows using a load testing tool. There are commercial ones: Mercury LoadRunner, Borland SilkPerformer and Microsoft Team Test.

We might also get creative using functional testing tools such as Watir or Selenium, or even trusty wget, or curl, to drive load.

We can use our laptop(s), or Amazon EC2, as load agents, which would be generating user traffic on the site by running our scripts.

It doesn't have to be as hard as all this, though testing generally spirals into a quagmire if we aren't careful to make sure we are testing the right flows and maybe just as important, measuring our application. Without measurements, we won't know if changes to code or configuration, made things better or worse.

disclaimer: I've never had a production Rails application, but if I did, I'd use New Relic to monitor it. At least to start, especially since we are already on Heroku.

like image 41
Zach Bonham Avatar answered Oct 24 '22 04:10

Zach Bonham