How can I check how many requests per second my app can handle?
Asked Answered
T

3

6

I have created a new app, and I plan on adding caching, cdn, and other performance improving methods. I would like to check the current performance and also after each of these methods I would like to check the performance again. This is a Rails app.

How should I go about it? Is there a command I can use to check this? do I need to run a test? how? From what I've searhced it seems that new relic gives a lot of this information, but it seems to me that that's only on live data, and I'd like to test the max that the app can handle (for instance before and after performing the above changes) in addition to monitoring live data.

Trifid answered 30/4, 2013 at 10:22 Comment(0)
A
7

One easy way is to use apache bench:

ab -n 2000 -c 200 http://yourdomain.com/

where n is the number of requests to make and c is the number of clients to use.

You will get a report like

Document Path:          /
Document Length:        36153 bytes

Concurrency Level:      200
Time taken for tests:   4.544 seconds
Complete requests:      2000
Failed requests:        0
Write errors:           0
Total transferred:      72732000 bytes
HTML transferred:       72306000 bytes
Requests per second:    440.17 [#/sec] (mean)
Time per request:       454.366 [ms] (mean)
Time per request:       2.272 [ms] (mean, across all concurrent requests)
Transfer rate:          15632.19 [Kbytes/sec] received

Connection Times (ms)
          min  mean[+/-sd] median   max
Connect:       72   77  59.1     73    1075
Processing:   160  357  96.3    325     636
Waiting:       73  196  95.9    165     488
Total:        234  434 109.9    398    1340

Percentage of the requests served within a certain time (ms)
  50%    398
  66%    419
  75%    440
  80%    468
  90%    607
  95%    671
  98%    688
  99%    700
 100%   1340 (longest request)
Avocation answered 30/4, 2013 at 10:37 Comment(2)
Great, thanks. I'm getting Send request timed out! what should I do? does it mean I tried too high a number of requests? what numbers should I use of clients vs requests? and how do I make sure it doesn't time-out? shouldn't it just tell me "unable to complete some of the requests" and not time out?Trifid
FYI, ab is usually bundled with the apache package.Outguess
S
1

New Relic also allows you to store data. Depending on your account type, you can get up to unlimited data retention. The standard type account gives you 7 days of data retention. That should be enough for your purpose.

You can then use load testing apps, like jMeter or Apache bench. There are also web based tools like blitz.io and Loadimpact.

Somber answered 30/4, 2013 at 10:37 Comment(1)
Absolutely. New Relic can be configured to look at your staging site where you run the load testing apps before you ever get to production.Chiro
S
1

Its a little bit complicate to configure but I suggest jMeter. You can build your HTTP (or other supported) requests in it, set your parameters, headers. This way you can load test specific pages. ab can be reliable for static pages, but if your website have database interaction you might want to simulate those user interactions in your load test.

JMeter User Manual

Jmeter Tutorial

Stereogram answered 30/4, 2013 at 11:7 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.