Prasanna
Prasanna

Reputation: 11544

Load testing Rails application

Can someone help with guidelines for load testing a Rails application, preferably using Rspec.

The load test i refer is with lots of data and not about multiple requests.

Basically i would like to setup all the data for the application, and will like to hit all the routes and get a metrics of the time.

I was looking into this gist using Rails Benchmark, However i can't list all my routes in a single spec.

Any tips about where to look out will be helpful.

Upvotes: 2

Views: 600

Answers (1)

sandrew
sandrew

Reputation: 3129

I would advise you to leave that idea. This intention is a waste of time for a plenty of reasons:

  • you are running tests on development machine, but you need load-testing results from production machine. It's not so useful of knowing average request time on your 8GB-memory MacBook when your real production app will run on 512MB VPS.
  • RSpec test environment has much difference from production environment. That includes controllers cache, code pre-loading and much more.
  • Different server environments: running load-tests on development machine DB with configs from scratch and on production machine with tuned DB configs will give results as different as black and white.
  • Most important reason: you should understand what and why you are load-testing. This stands on optimization theory and brief explanation is:

When you are optimizing your app or setting it up for a high-load, you can not just start measuring every single request, because it's a waste of time. You should understand most tight parts of your app that can become bottle-necks.

My advise - read some material on designing high-load systems for newbies. And then you can use some special instruments like MS Azure load-testing on your staging or production environment.

Upvotes: 2

Related Questions