From: Eric Wong <e@80x24.org>
To: Sam Saffron <sam.saffron@gmail.com>
Cc: unicorn-public@bogomips.org
Subject: Re: Auto scaling workers with unicorn
Date: Tue, 5 Dec 2017 01:51:58 +0000 [thread overview]
Message-ID: <20171205015158.GA2540@starla> (raw)
In-Reply-To: <CAAtdryPUp3hSvrCCqOfs9B-DVsXnJdR=eKED8RzX5Duy5YXBCA@mail.gmail.com>
Sam Saffron <sam.saffron@gmail.com> wrote:
> I would like to amend Discourse so we "automatically" absorb certain
> traffic spikes. As it stands we can only configure unicorn with
> num_workers and use TTIN and TTOUT to tune the number on the fly.
>
> I was wondering if you would be open to patching unicorn to allow it
> to perform auto-tuning based on raindrops info.
I'm no fan of this or auto-tuning systems in general.
More explanation below.
> How it could work
>
> 1. configure unicorn with min_workers, max_workers, wince_delay, scale_up_delay
>
> 2. If queued requests is over 0 for N samples over scale_up_delay, add
> a worker up until max_workers
>
> 3. If queued requests is 0 for N samples over wince_delay scale down
> until you reach min workers
This adds more complexity to configuration: increasing the
likelyhood of getting these numbers completely wrong. GC and
malloc tuning is tricky and error-prone enough, already.
Mainly, this tends to hide problems for later; instead of
forcing you to deal with your resource limitations up front.
It becomes more difficult to forsee resource limitations down
the line. Before I worked on unicorn, I've seen auto-scaling
Apache workers mistuned far too often and running out of DB
connections or memory; and that happens at the worst time:
when your site is under heavy load (when you have the most to
lose (or gain)).
> Having this system in place can heavily optimize memory in large
> deployments and simplifies provisioning logic quite a lot.
My philosophy remains to tune for the worst case possible.
If you really need to do something like run an expensive
off-peak cronjob, maybe have it TTIN at the beginning and TTOU
again at the end.
Fwiw, the most useful thing I've found TTIN/TTOU for is cutting
down to one worker so I know which one to strace when tracking
down a problem; not auto-scaling.
> Wondering what you think about this and if you think unicorn should
> provide this option?
Fwiw, my position has been consistent on this throughout the years.
Also, digging through the archives, Ben Somers came up with
alicorn a while back and it might be up your alley:
https://bogomips.org/unicorn-public/CAO1NZApo0TLJY2KgSg+Fjt1jEcuPfq=UCC0SCvvnuGDnr39w8w@mail.gmail.com/
next prev parent reply other threads:[~2017-12-05 1:51 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-04 23:42 Auto scaling workers with unicorn Sam Saffron
2017-12-05 1:51 ` Eric Wong [this message]
2017-12-05 2:33 ` Ben Somers
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=20171205015158.GA2540@starla \
--to=e@80x24.org \
--cc=sam.saffron@gmail.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).