unicorn Ruby/Rack server user+dev discussion/patches/pulls/bugs/help
 help / color / mirror / code / Atom feed
From: Carl Brasic <cbrasic@gmail.com>
To: Christian Pedersen <christian@onelogin.com>
Cc: unicorn-public@bogomips.org
Subject: Re: Monitoring active/idle unicorn process stats
Date: Wed, 2 Sep 2015 18:31:57 +0200	[thread overview]
Message-ID: <CAD-jRAcHR7sqfTgda0p3AG51tO_pB1JeWPfLKCAyBCcQj7NdPA@mail.gmail.com> (raw)
In-Reply-To: <CAE2Ar51tfuR8mJ99KmDj75p-JJOTAgYbOAwNaC-5b4-Pw__XTg@mail.gmail.com>

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

  reply	other threads:[~2015-09-02 16:32 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-02 15:49 Monitoring active/idle unicorn process stats Christian Pedersen
2015-09-02 16:31 ` Carl Brasic [this message]
2015-09-02 16:48 ` Eric Wong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://yhbt.net/unicorn/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAD-jRAcHR7sqfTgda0p3AG51tO_pB1JeWPfLKCAyBCcQj7NdPA@mail.gmail.com \
    --to=cbrasic@gmail.com \
    --cc=christian@onelogin.com \
    --cc=unicorn-public@bogomips.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhbt.net/unicorn.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).