in reply to Re^3: How to count the number of pending clients in socket queue?
in thread How to count the number of pending clients in socket queue?

Greetings, kschwab.

Let me preface the following, by letting you know, I'm not trying to be argumentative. :)

I should also note; that I'm speaking from a *BSD box. So this might explain differences.

'nuff said.
So my experiences seem to be a bit different. For example. My last log entry (somewhat abreviated):

:8090 tcpflags 0x2<SYN>; tcp_input: Connection attempt to closed port
Is fairly informative. I can also get pretty detailed information from netstat, and lsof: WAIT, LISTEN, ...

I cant speak for Linux, or OSX, for that matter (altho OSX uses BSD). But at least on BSD, it seems like I could get that sort of information. I'll look a bit deeper, and see if I can get the kind of output the OP's looking for.

--Chris

#!/usr/bin/perl -Tw
use Perl::Always or die;
my $perl_version = (5.12.5);
print $perl_version;

Replies are listed 'Best First'.
Re^5: How to count the number of pending clients in socket queue?
by kschwab (Vicar) on Nov 18, 2013 at 13:55 UTC
    All interesting info. None of it is the current depth of the listenq. I suppose you could use a kernel debugger and find it, but the current number of "connections waiting for the accept() call" isn't in lsof, /proc, netstat, etc.
      In this case (the OP). There is no argument.

      I did some more investigation, and in doing so. Remembered I had tuned my kernel ( via sysctl) in such a way. That I receive more information, than is normally generated. Frankly, I haven't any idea whether it's even possible on Linux, and am quite sure, unavailable in Windows.
      D'OH!

      ++ to you, kschwab. Apologies for the noise.

      --Chris

      #!/usr/bin/perl -Tw
      use Perl::Always or die;
      my $perl_version = (5.12.5);
      print $perl_version;

        Actually, I think you're right. I checked out morgon's post below, and it looks like "Recv-Q" is overloaded for LISTEN sockets to show the current listenq depth. I experimented a bit and created a server that just listened, and never accept()ed. The number grows with each connected client, and stops growing at whatever you set the listenq size to. Connetions up to listenq size show as "ESTABLISHED", and ones after that show in a SYN-RECV state

        So, at least on linux then, you can use ss, netstat, or the /proc entry morgon pointed out...I was wrong. That said, I still think that spinning up more workers is best done by noting when you're out of them. That will happen before connections pile up on the listenq