unicorn Ruby/Rack server user+dev discussion/patches/pulls/bugs/help
 help / color / mirror / code / Atom feed
* listen backlog
@ 2010-12-03  1:35 ghazel
  2010-12-03  2:39 ` Eric Wong
  0 siblings, 1 reply; 9+ messages in thread
From: ghazel @ 2010-12-03  1:35 UTC (permalink / raw)
  To: mongrel-unicorn

I found this thread
http://rubyforge.org/pipermail/mongrel-unicorn/2009-September/000031.html
after googling for the same error located in my nginx error log.

Is there some way to discover the current queue length of the backlog?
Increasing the maximum size to 2048 "worked" for me as well, but
obviously clients sit in the queue for a long time. If I could monitor
queue length I could get some idea of when I have insufficient unicorn
workers before the delay gets very high or requests fail.

Thanks in advance!

-Greg
_______________________________________________
Unicorn mailing list - mongrel-unicorn@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-unicorn
Do not quote signatures (like this one) or top post when replying


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

* Re: listen backlog
  2010-12-03  1:35 listen backlog ghazel
@ 2010-12-03  2:39 ` Eric Wong
  2010-12-03  5:31   ` ghazel
  0 siblings, 1 reply; 9+ messages in thread
From: Eric Wong @ 2010-12-03  2:39 UTC (permalink / raw)
  To: unicorn list

ghazel@gmail.com wrote:
> I found this thread
> http://rubyforge.org/pipermail/mongrel-unicorn/2009-September/000031.html
> after googling for the same error located in my nginx error log.
> 
> Is there some way to discover the current queue length of the backlog?
> Increasing the maximum size to 2048 "worked" for me as well, but
> obviously clients sit in the queue for a long time. If I could monitor
> queue length I could get some idea of when I have insufficient unicorn
> workers before the delay gets very high or requests fail.

If you're using Linux, you can use Raindrops[1] to interrogate
via inet_diag or parse /proc/net/{tcp,unix} yourself.

You can run Raindrops separate/standalone script:
http://git.bogomips.org/cgit/raindrops.git/tree/examples/linux-tcp-listener-stats.rb

Or use it as middleware (see webpage):
http://raindrops.bogomips.org/

git clone git://git.bogomips.org/raindrops

-- 
Eric Wong
_______________________________________________
Unicorn mailing list - mongrel-unicorn@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-unicorn
Do not quote signatures (like this one) or top post when replying


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

* Re: listen backlog
  2010-12-03  2:39 ` Eric Wong
@ 2010-12-03  5:31   ` ghazel
  2010-12-03  7:35     ` Eric Wong
  0 siblings, 1 reply; 9+ messages in thread
From: ghazel @ 2010-12-03  5:31 UTC (permalink / raw)
  To: unicorn list

On Thu, Dec 2, 2010 at 6:39 PM, Eric Wong <normalperson@yhbt.net> wrote:
> ghazel@gmail.com wrote:
>> I found this thread
>> http://rubyforge.org/pipermail/mongrel-unicorn/2009-September/000031.html
>> after googling for the same error located in my nginx error log.
>>
>> Is there some way to discover the current queue length of the backlog?
>> Increasing the maximum size to 2048 "worked" for me as well, but
>> obviously clients sit in the queue for a long time. If I could monitor
>> queue length I could get some idea of when I have insufficient unicorn
>> workers before the delay gets very high or requests fail.
>
> If you're using Linux, you can use Raindrops[1] to interrogate
> via inet_diag or parse /proc/net/{tcp,unix} yourself.
>
> You can run Raindrops separate/standalone script:
> http://git.bogomips.org/cgit/raindrops.git/tree/examples/linux-tcp-listener-stats.rb
>
> Or use it as middleware (see webpage):
> http://raindrops.bogomips.org/
>
> git clone git://git.bogomips.org/raindrops

Amazing! I had somehow never heard of it. I use a unix socket for
unicorn (should I not?) so I had to make a copy of
linux-tcp-listener-stats.rb to support that. Now I'm able to get stats
for my unicorn master.

However, there seems to be some problem getting stats on TCP sockets:

$ ruby linux-tcp-listener-stats.rb 127.0.0.1:9000
            address     active     queued
linux-tcp-listener-stats.rb:42:in `tcp_listener_stats': Connection
refused - sendmsg (Errno::ECONNREFUSED)
        from linux-tcp-listener-stats.rb:42
$ grep  0100007F:2328 /proc/net/tcp
   1: 0100007F:2328 00000000:0000 0A 00000000:00000000 00:00000000
00000000   500        0 25307310 1 ffff880134471700 3000 0 0 2 -1

None of the TCP sockets I know to exist seem to work - they all fail
with that error.

Any ideas?

-Greg
_______________________________________________
Unicorn mailing list - mongrel-unicorn@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-unicorn
Do not quote signatures (like this one) or top post when replying


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

* Re: listen backlog
  2010-12-03  5:31   ` ghazel
@ 2010-12-03  7:35     ` Eric Wong
  2010-12-03  9:16       ` ghazel
  0 siblings, 1 reply; 9+ messages in thread
From: Eric Wong @ 2010-12-03  7:35 UTC (permalink / raw)
  To: unicorn list

ghazel@gmail.com wrote:
> On Thu, Dec 2, 2010 at 6:39 PM, Eric Wong <normalperson@yhbt.net> wrote:
> > ghazel@gmail.com wrote:
> >> I found this thread
> >> http://rubyforge.org/pipermail/mongrel-unicorn/2009-September/000031.html
> >> after googling for the same error located in my nginx error log.
> >>
> >> Is there some way to discover the current queue length of the backlog?
> >> Increasing the maximum size to 2048 "worked" for me as well, but
> >> obviously clients sit in the queue for a long time. If I could monitor
> >> queue length I could get some idea of when I have insufficient unicorn
> >> workers before the delay gets very high or requests fail.
> >
> > If you're using Linux, you can use Raindrops[1] to interrogate
> > via inet_diag or parse /proc/net/{tcp,unix} yourself.
> >
> > You can run Raindrops separate/standalone script:
> > http://git.bogomips.org/cgit/raindrops.git/tree/examples/linux-tcp-listener-stats.rb
> >
> > Or use it as middleware (see webpage):
> > http://raindrops.bogomips.org/
> >
> > git clone git://git.bogomips.org/raindrops
> 
> Amazing! I had somehow never heard of it.

Yeah, I don't have much interest in marketing; that's what users are
for, but it's a chicken-and-egg problem :x

> I use a unix socket for unicorn (should I not?)

UNIX sockets are faster for nginx <-> Unicorn, but Raindrops is slower
dealing with them since Linux doesn't export UNIX sockets stats to
netlink the same way it does for TCP sockets.  So there's always a
tradeoff :x

> so I had to make a copy of
> linux-tcp-listener-stats.rb to support that. Now I'm able to get stats
> for my unicorn master
> 
> However, there seems to be some problem getting stats on TCP sockets:
> 
> $ ruby linux-tcp-listener-stats.rb 127.0.0.1:9000
>             address     active     queued
> linux-tcp-listener-stats.rb:42:in `tcp_listener_stats': Connection
> refused - sendmsg (Errno::ECONNREFUSED)
>         from linux-tcp-listener-stats.rb:42
> $ grep  0100007F:2328 /proc/net/tcp
>    1: 0100007F:2328 00000000:0000 0A 00000000:00000000 00:00000000
> 00000000   500        0 25307310 1 ffff880134471700 3000 0 0 2 -1
> 
> None of the TCP sockets I know to exist seem to work - they all fail
> with that error.

Odd, which kernel do you have?  You might want to "modprobe inet_diag"
if you're on an older kernel.  Or you can just comment-out the TCP
code and use the UNIX sockets code.

-- 
Eric Wong
_______________________________________________
Unicorn mailing list - mongrel-unicorn@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-unicorn
Do not quote signatures (like this one) or top post when replying


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

* Re: listen backlog
  2010-12-03  7:35     ` Eric Wong
@ 2010-12-03  9:16       ` ghazel
  2010-12-03 21:49         ` Eric Wong
  0 siblings, 1 reply; 9+ messages in thread
From: ghazel @ 2010-12-03  9:16 UTC (permalink / raw)
  To: unicorn list

On Thu, Dec 2, 2010 at 11:35 PM, Eric Wong <normalperson@yhbt.net> wrote:
> ghazel@gmail.com wrote:
>> On Thu, Dec 2, 2010 at 6:39 PM, Eric Wong <normalperson@yhbt.net> wrote:
>> > ghazel@gmail.com wrote:
>> >> I found this thread
>> >> http://rubyforge.org/pipermail/mongrel-unicorn/2009-September/000031.html
>> >> after googling for the same error located in my nginx error log.
>> >>
>> >> Is there some way to discover the current queue length of the backlog?
>> >> Increasing the maximum size to 2048 "worked" for me as well, but
>> >> obviously clients sit in the queue for a long time. If I could monitor
>> >> queue length I could get some idea of when I have insufficient unicorn
>> >> workers before the delay gets very high or requests fail.
>> >
>> > If you're using Linux, you can use Raindrops[1] to interrogate
>> > via inet_diag or parse /proc/net/{tcp,unix} yourself.
>> >
>> > You can run Raindrops separate/standalone script:
>> > http://git.bogomips.org/cgit/raindrops.git/tree/examples/linux-tcp-listener-stats.rb
>> >
>> > Or use it as middleware (see webpage):
>> > http://raindrops.bogomips.org/
>> >
>> > git clone git://git.bogomips.org/raindrops
>>
>> Amazing! I had somehow never heard of it.
>
> Yeah, I don't have much interest in marketing; that's what users are
> for, but it's a chicken-and-egg problem :x
>
>> I use a unix socket for unicorn (should I not?)
>
> UNIX sockets are faster for nginx <-> Unicorn, but Raindrops is slower
> dealing with them since Linux doesn't export UNIX sockets stats to
> netlink the same way it does for TCP sockets.  So there's always a
> tradeoff :x

When does that netlink speed difference matter - only when collecting stats?

>> so I had to make a copy of
>> linux-tcp-listener-stats.rb to support that. Now I'm able to get stats
>> for my unicorn master
>>
>> However, there seems to be some problem getting stats on TCP sockets:
>>
>> $ ruby linux-tcp-listener-stats.rb 127.0.0.1:9000
>>             address     active     queued
>> linux-tcp-listener-stats.rb:42:in `tcp_listener_stats': Connection
>> refused - sendmsg (Errno::ECONNREFUSED)
>>         from linux-tcp-listener-stats.rb:42
>> $ grep  0100007F:2328 /proc/net/tcp
>>    1: 0100007F:2328 00000000:0000 0A 00000000:00000000 00:00000000
>> 00000000   500        0 25307310 1 ffff880134471700 3000 0 0 2 -1
>>
>> None of the TCP sockets I know to exist seem to work - they all fail
>> with that error.
>
> Odd, which kernel do you have?  You might want to "modprobe inet_diag"
> if you're on an older kernel.  Or you can just comment-out the TCP
> code and use the UNIX sockets code.

Linux hostname 2.6.21.7-2.fc8xen #1 SMP Fri Feb 15 12:34:28 EST 2008
x86_64 x86_64 x86_64 GNU/Linux

Using "modprobe inet_diag" made the script spit out a new error:

            address     active     queued
linux-tcp-listener-stats.rb:42:in `tcp_listener_stats': NLMSG_ERROR
(RuntimeError)
        from linux-tcp-listener-stats.rb:42

$ sudo modprobe -l inet_diag
/lib/modules/2.6.21.7-2.fc8xen/kernel/net/ipv4/inet_diag.ko

I dug in to raindrops a little bit, and it seems the error associated
with the NLMSG_ERROR is -2,
"No such file or directory".


-Greg
_______________________________________________
Unicorn mailing list - mongrel-unicorn@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-unicorn
Do not quote signatures (like this one) or top post when replying

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

* Re: listen backlog
  2010-12-03  9:16       ` ghazel
@ 2010-12-03 21:49         ` Eric Wong
  2010-12-03 22:49           ` ghazel
  0 siblings, 1 reply; 9+ messages in thread
From: Eric Wong @ 2010-12-03 21:49 UTC (permalink / raw)
  To: unicorn list

ghazel@gmail.com wrote:
> On Thu, Dec 2, 2010 at 11:35 PM, Eric Wong <normalperson@yhbt.net> wrote:
> > UNIX sockets are faster for nginx <-> Unicorn, but Raindrops is slower
> > dealing with them since Linux doesn't export UNIX sockets stats to
> > netlink the same way it does for TCP sockets.  So there's always a
> > tradeoff :x
> 
> When does that netlink speed difference matter - only when collecting stats?

Yes, the performance difference is only when collecting stats.

> Using "modprobe inet_diag" made the script spit out a new error:
> 
>             address     active     queued
> linux-tcp-listener-stats.rb:42:in `tcp_listener_stats': NLMSG_ERROR
> (RuntimeError)
>         from linux-tcp-listener-stats.rb:42

I don't think I've ever seen NLMSG_ERROR before.  Are you running
this as the same user that originally bound the listener (the user
of the Unicorn master process)?

> $ sudo modprobe -l inet_diag
> /lib/modules/2.6.21.7-2.fc8xen/kernel/net/ipv4/inet_diag.ko
> 
> I dug in to raindrops a little bit, and it seems the error associated
> with the NLMSG_ERROR is -2,
> "No such file or directory".

Are you bound to 0.0.0.0:9000 and not 127.0.0.1:9000?  Use
0.0.0.0:9000 if you're bound to that (I had another user on the
raindrops mailing list with that problem).

-- 
Eric Wong
_______________________________________________
Unicorn mailing list - mongrel-unicorn@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-unicorn
Do not quote signatures (like this one) or top post when replying


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

* Re: listen backlog
  2010-12-03 21:49         ` Eric Wong
@ 2010-12-03 22:49           ` ghazel
  2010-12-04 23:48             ` Eric Wong
  0 siblings, 1 reply; 9+ messages in thread
From: ghazel @ 2010-12-03 22:49 UTC (permalink / raw)
  To: unicorn list

On Fri, Dec 3, 2010 at 1:49 PM, Eric Wong <normalperson@yhbt.net> wrote:
> ghazel@gmail.com wrote:
>> Using "modprobe inet_diag" made the script spit out a new error:
>>
>>             address     active     queued
>> linux-tcp-listener-stats.rb:42:in `tcp_listener_stats': NLMSG_ERROR
>> (RuntimeError)
>>         from linux-tcp-listener-stats.rb:42
>
> I don't think I've ever seen NLMSG_ERROR before.  Are you running
> this as the same user that originally bound the listener (the user
> of the Unicorn master process)?

Yes. I also tried as root, same error.

>> $ sudo modprobe -l inet_diag
>> /lib/modules/2.6.21.7-2.fc8xen/kernel/net/ipv4/inet_diag.ko
>>
>> I dug in to raindrops a little bit, and it seems the error associated
>> with the NLMSG_ERROR is -2,
>> "No such file or directory".
>
> Are you bound to 0.0.0.0:9000 and not 127.0.0.1:9000?  Use
> 0.0.0.0:9000 if you're bound to that (I had another user on the
> raindrops mailing list with that problem).

My unicorn.rb says 127.0.0.1. But just to test I tried fetching stats
for 0.0.0.0:9000 but got the same error.

-Greg
_______________________________________________
Unicorn mailing list - mongrel-unicorn@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-unicorn
Do not quote signatures (like this one) or top post when replying

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

* Re: listen backlog
  2010-12-03 22:49           ` ghazel
@ 2010-12-04 23:48             ` Eric Wong
  2010-12-05  0:02               ` ghazel
  0 siblings, 1 reply; 9+ messages in thread
From: Eric Wong @ 2010-12-04 23:48 UTC (permalink / raw)
  To: unicorn list

ghazel@gmail.com wrote:
> On Fri, Dec 3, 2010 at 1:49 PM, Eric Wong <normalperson@yhbt.net> wrote:
> > ghazel@gmail.com wrote:
> >> Using "modprobe inet_diag" made the script spit out a new error:
> >>
> >>             address     active     queued
> >> linux-tcp-listener-stats.rb:42:in `tcp_listener_stats': NLMSG_ERROR
> >> (RuntimeError)
> >>         from linux-tcp-listener-stats.rb:42
> >
> > I don't think I've ever seen NLMSG_ERROR before.  Are you running
> > this as the same user that originally bound the listener (the user
> > of the Unicorn master process)?
> 
> Yes. I also tried as root, same error.
> 
> >> $ sudo modprobe -l inet_diag
> >> /lib/modules/2.6.21.7-2.fc8xen/kernel/net/ipv4/inet_diag.ko
> >>
> >> I dug in to raindrops a little bit, and it seems the error associated
> >> with the NLMSG_ERROR is -2,
> >> "No such file or directory".
> >
> > Are you bound to 0.0.0.0:9000 and not 127.0.0.1:9000?  Use
> > 0.0.0.0:9000 if you're bound to that (I had another user on the
> > raindrops mailing list with that problem).
> 
> My unicorn.rb says 127.0.0.1. But just to test I tried fetching stats
> for 0.0.0.0:9000 but got the same error.

Ah, can you try "modprobe tcp_diag", too?  I can't remember what other
quirks there were for ancient kernels.  Hopefully that works, because
I'd be at a loss otherwise :x

-- 
Eric Wong
_______________________________________________
Unicorn mailing list - mongrel-unicorn@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-unicorn
Do not quote signatures (like this one) or top post when replying


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

* Re: listen backlog
  2010-12-04 23:48             ` Eric Wong
@ 2010-12-05  0:02               ` ghazel
  0 siblings, 0 replies; 9+ messages in thread
From: ghazel @ 2010-12-05  0:02 UTC (permalink / raw)
  To: unicorn list

On Sat, Dec 4, 2010 at 3:48 PM, Eric Wong <normalperson@yhbt.net> wrote:
> ghazel@gmail.com wrote:
>> On Fri, Dec 3, 2010 at 1:49 PM, Eric Wong <normalperson@yhbt.net> wrote:
>> > ghazel@gmail.com wrote:
>> >> Using "modprobe inet_diag" made the script spit out a new error:
>> >>
>> >>             address     active     queued
>> >> linux-tcp-listener-stats.rb:42:in `tcp_listener_stats': NLMSG_ERROR
>> >> (RuntimeError)
>> >>         from linux-tcp-listener-stats.rb:42
>> >
>> > I don't think I've ever seen NLMSG_ERROR before.  Are you running
>> > this as the same user that originally bound the listener (the user
>> > of the Unicorn master process)?
>>
>> Yes. I also tried as root, same error.
>>
>> >> $ sudo modprobe -l inet_diag
>> >> /lib/modules/2.6.21.7-2.fc8xen/kernel/net/ipv4/inet_diag.ko
>> >>
>> >> I dug in to raindrops a little bit, and it seems the error associated
>> >> with the NLMSG_ERROR is -2,
>> >> "No such file or directory".
>> >
>> > Are you bound to 0.0.0.0:9000 and not 127.0.0.1:9000?  Use
>> > 0.0.0.0:9000 if you're bound to that (I had another user on the
>> > raindrops mailing list with that problem).
>>
>> My unicorn.rb says 127.0.0.1. But just to test I tried fetching stats
>> for 0.0.0.0:9000 but got the same error.
>
> Ah, can you try "modprobe tcp_diag", too?  I can't remember what other
> quirks there were for ancient kernels.  Hopefully that works, because
> I'd be at a loss otherwise :x

Ah! That worked. Thanks!

-Greg
_______________________________________________
Unicorn mailing list - mongrel-unicorn@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-unicorn
Do not quote signatures (like this one) or top post when replying

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

end of thread, other threads:[~2010-12-05  0:16 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-12-03  1:35 listen backlog ghazel
2010-12-03  2:39 ` Eric Wong
2010-12-03  5:31   ` ghazel
2010-12-03  7:35     ` Eric Wong
2010-12-03  9:16       ` ghazel
2010-12-03 21:49         ` Eric Wong
2010-12-03 22:49           ` ghazel
2010-12-04 23:48             ` Eric Wong
2010-12-05  0:02               ` ghazel

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).