How to see nginx rps (requests per second)

Hi Guys,

I have enable stub module and location /status/ in nginx.conf

All I see just :

Active connections: 1
server accepts handled requests
478077 478077 478271
Reading: 0 Writing: 1 Waiting: 0

How can I know which values is the rps of the nginx server ?

Thanks guys.

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,220831,220831#msg-220831

use ApacheBench(ab), http_load, siege or other performance tools

blog: http://chenxiaoyu.org

2012/1/5 atrus [email protected]

Hi,

I beleive the stub module gives the number of requests since nginx was
last reloaded (or started). To get the number of rps, you have to query
the stub module each second and substract the old value from the current
value.

Regards,

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,220831,220834#msg-220834

Thanks Yogui.

Is there any other ways to do this automatically instead of manually
subtract ?! I want to see in live.

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,220831,220843#msg-220843

If you’ve logging enabled in some sort, you could use a Visual Log
Analyzer, I know some of them work for Apache-style logs, but it
requires the overhead of having logging enabled for your webserver.

Such log-analysers don’t need many resources, as they don’t require any
interaction with requests served by nginx, they just read the logs nginx
produces every x seconds.

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,220831,220905#msg-220905

On Jan 5, 2012, at 9:12 AM, atrus wrote:

Is there any other ways to do this automatically instead of manually
subtract ?! I want to see in live.

we have some command line ruby/perl scripts that do this, pretty simple.
If you wanted to do this “in” nginx, I guess the easiest way would be
using Lua that did a location_capture of stub_status and cached the
value ( using http://wiki.nginx.org/HttpLuaModule#ngx.shared.DICT
maybe).

Or, have a script that polls nginx stub status every x seconds and
writes it out to a static file that nginx can serve.

I’d rather nginx just provide the raw data and I can slice and dice it
for my own needs.

–Brian

@atrus

Please remember that what you are looking for is a “human” value, as
opposed to the snapshot type of values the server can reliably provide.
The reason why nginx does not provide what you are looking for may be
that the server would have to provide several intervals to satisfy
everyone (second, millisecond, minute, hour, etc.), and that is neither
practical nor reliable. Such data could also be misleading, depending on
your use case. From a server point of view, the best thing to do was to
give a total number of requests served and let the admins do the math as
they see fit.

However, the stub status module provides easy-to-read data that you can
parse with a script in a loop, or such a script could dump the stats in
a database and you could then read that. That is the best long-term
solution to your problem. Please remember too that this database does
not need to be SQL, it could be RRD-based for example, or just plain
files, whatever suits you best.

Regards,

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,220831,220908#msg-220908

atrus wrote in post #1039525:

Hi Guys,

I have enable stub module and location /status/ in nginx.conf

All I see just :

Active connections: 1
server accepts handled requests
478077 478077 478271
Reading: 0 Writing: 1 Waiting: 0

How can I know which values is the rps of the nginx server ?

Thanks guys.

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,220831,220831#msg-220831

If you are just interested in knowing Request per second and if you have
logging enabled then I would suggest using netcat. you just need to tail
the log file and then use the netcat to count the lines and it would
give you the details you need. Since the tail by default updates every 1
second you will get what you need.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs