unicorn Ruby/Rack server user+dev discussion/patches/pulls/bugs/help
 help / color / Atom feed
* Monitoring active/idle unicorn process stats
@ 2015-09-02 15:49 Christian Pedersen
  2015-09-02 16:31 ` Carl Brasic
  2015-09-02 16:48 ` Eric Wong
  0 siblings, 2 replies; 3+ messages in thread
From: Christian Pedersen @ 2015-09-02 15:49 UTC (permalink / raw)
  To: unicorn-public

Hi!

Is it possible to query the number of busy/idle unicorn workers? For
scaling purposes, I would like to be able to see the utilisation of
the unicorn workers, so I will know if I need to deploy more servers
in peak hours or not. Currently the only measure I have is when
machines top out and start serving 502's. I am not interested in
queueing up requests, as the approach is to instead spin up additional
capacity when needed.

I notice on http://demo.nginx.com/status.html that one of the metrics
under 'demoupstreams' is the number of active connections. I wonder if
that metric is exposed by nginx somehow, or if this is something only
available in nginx plus. Suggestions for alternative approaches to
this is appreciated. Ideally, I would like a metric that I can consume
and pump into our monitoring tools with a fairly high resolution.

Cheers,
Christian

-- 
christian b pedersen | cto | christian@onelogin.com | +1 310-383-0809

Join us at OneLogin Connect: Our International User Group Tour

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Monitoring active/idle unicorn process stats
  2015-09-02 15:49 Monitoring active/idle unicorn process stats Christian Pedersen
@ 2015-09-02 16:31 ` Carl Brasic
  2015-09-02 16:48 ` Eric Wong
  1 sibling, 0 replies; 3+ messages in thread
From: Carl Brasic @ 2015-09-02 16:31 UTC (permalink / raw)
  To: Christian Pedersen; +Cc: unicorn-public

On Wed, Sep 2, 2015 at 5:49 PM, Christian Pedersen
<christian@onelogin.com> wrote:
> Hi!
>
> Is it possible to query the number of busy/idle unicorn workers? For
> scaling purposes, I would like to be able to see the utilisation of
> the unicorn workers, so I will know if I need to deploy more servers
> in peak hours or not. Currently the only measure I have is when
> machines top out and start serving 502's. I am not interested in
> queueing up requests, as the approach is to instead spin up additional
> capacity when needed.
>
> I notice on http://demo.nginx.com/status.html that one of the metrics
> under 'demoupstreams' is the number of active connections. I wonder if
> that metric is exposed by nginx somehow, or if this is something only
> available in nginx plus. Suggestions for alternative approaches to
> this is appreciated. Ideally, I would like a metric that I can consume
> and pump into our monitoring tools with a fairly high resolution.
>
> Cheers,
> Christian

Assuming you are proxying via domain socket, raindrops includes a
parser to extract the socket's active and queued connections.  We use
a script that publishes the following to our monitoring tools:

    Raindrops::Linux.unix_listener_stats(["/path/to/socket"])[0]
    # => #<struct Raindrops::ListenStats active=6, queued=0>

If you want to call this repeatedly without a process supervisor, you
can use bash scripts embedded in cron to get arbitrary granularity:

    SHELL=bash
    * * * * * for ((n=0;n<12;n++)); do /bin/publish_stats; sleep 5; done

Carl

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Monitoring active/idle unicorn process stats
  2015-09-02 15:49 Monitoring active/idle unicorn process stats Christian Pedersen
  2015-09-02 16:31 ` Carl Brasic
@ 2015-09-02 16:48 ` Eric Wong
  1 sibling, 0 replies; 3+ messages in thread
From: Eric Wong @ 2015-09-02 16:48 UTC (permalink / raw)
  To: Christian Pedersen; +Cc: unicorn-public

Christian Pedersen <christian@onelogin.com> wrote:
> Is it possible to query the number of busy/idle unicorn workers?

What Carl said.  You can also use Raindrops::Linux.tcp_listener_stats
for TCP for a similar effect.

Raindrops also includes a different module, Raindrops::Watcher,
to be used as a Rack endpoint to show the number of active/queued
connections.  You can see a demo of this at:

	http://raindrops-demo.bogomips.org:8080/

(It also works for Unix sockets, but I only have TCP sockets configured)

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, back to index

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-02 15:49 Monitoring active/idle unicorn process stats Christian Pedersen
2015-09-02 16:31 ` Carl Brasic
2015-09-02 16:48 ` Eric Wong

unicorn Ruby/Rack server user+dev discussion/patches/pulls/bugs/help

Archives are clonable:
	git clone --mirror https://bogomips.org/unicorn-public
	git clone --mirror http://ou63pmih66umazou.onion/unicorn-public

Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.lang.ruby.unicorn
	nntp://ou63pmih66umazou.onion/inbox.comp.lang.ruby.unicorn

 note: .onion URLs require Tor: https://www.torproject.org/

AGPL code for this site: git clone https://public-inbox.org/ public-inbox