raindrops RubyGem user+dev discussion/patches/pulls/bugs/help
 help / color / Atom feed
From: Ryan King <ryan@twitter.com>
To: raindrops@librelist.com
Subject: Re: queued is always 0
Date: Tue, 29 Jun 2010 18:12:47 -0700
Message-ID: <AANLkTimHNhnu7vkzo7yu3IK4ODIhoYRvm8zmaBepm0SA@mail.gmail.com> (raw)
In-Reply-To: <20100629005007.GA25438@dcvr.yhbt.net>

On Mon, Jun 28, 2010 at 5:50 PM, Eric Wong <normalperson@yhbt.net> wrote:
> Ryan King <ryan@twitter.com> wrote:
>> I'm trying to see if raindrops will help us instrument our stack, so
>> I'm doing some tests.
>>
>> I have 16 unicorns running our app with rainbows and am hitting it
>> with ab with a concurrency of 100. However, according to
>> linux-tcp-listener-stats.rb I have 0 queued requests. Maybe I'm
>> missing something, but shouldn't there be queued requests somewhere
>> here?
>
> Hi Ryan,
>
> The Unicorns could be accept()-ing connections fast enough and the
> queued connections aren't noticeable[1].
>
> Try sending SIGWINCH to the Unicorn master process and they
> should be queueing up because all the workers will have stopped.
> (SIGHUP to restart the workers).
>
>
> You can test and walk through this yourself on IRB, too:
>
> 1. startup irb: "irb -rsocket", then inside irb:
>
>   server = TCPServer.new '127.0.0.1', 3000
>
>
> 2. Now, hit the address you started the server on in a different
>   terminal with curl:
>
>     curl -v http://127.0.0.1:3000/  # curl should block here
>
> 3. Run linux-tcp-listener-stats:
>
>    ./examples/linux-tcp-listener-stats.rb 127.0.0.1:3000
>    # You should see one queued, zero active
>
> 4. Back in irb, accept the connection:
>
>   client = server.accept # should get a TCPSocket object
>
> 5. Run linux-tcp-listener-stats again:
>
>    ./examples/linux-tcp-listener-stats.rb 127.0.0.1:3000
>    # You should see one active, zero queued
>
>
> If you fire up more curl instances in other terminals without
> running "server.accept" in IRB, you should see more queued.
>
> Let me know how it goes for you.
>
> [1] - On a side note, Unicorn is very aggressive about accepting
>      connections, it speculatively tries to accept() after each
>      application dispatch (which could've taken a long time)
>      instead of running select() on the listen socket first.

I did as you describe here and I got the expected results.

I think I'm just confused at this point. We have 16 unicorns running,
with 100 clients, but no queued connections, which makes me assume
that we have accepted connections that we can't actually service yet.
Is this true?

-ryan

  reply index

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-29  0:26 Ryan King
2010-06-29  0:50 ` Eric Wong
2010-06-30  1:12   ` Ryan King [this message]
2010-06-30  2:45     ` Eric Wong
2010-06-30 18:51       ` Ryan King
2010-06-30 23:18         ` Ryan King
2010-07-01 10:18         ` Eric Wong
2010-07-01 18:37           ` Ryan King
2010-07-02  2:51             ` Eric Wong

Reply instructions:

You may reply publically 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/raindrops/

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

  git send-email \
    --in-reply-to=AANLkTimHNhnu7vkzo7yu3IK4ODIhoYRvm8zmaBepm0SA@mail.gmail.com \
    --to=ryan@twitter.com \
    --cc=raindrops@librelist.com \
    /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

raindrops RubyGem user+dev discussion/patches/pulls/bugs/help

Archives are clonable:
	git clone --mirror https://yhbt.net/raindrops-public
	git clone --mirror http://ou63pmih66umazou.onion/raindrops-public

Example config snippet for mirrors

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

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

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