Dropped connections

Marcel Wijnen mmfwwijnen at gmail.com
Wed Aug 29 21:03:04 CEST 2012


Ofcourse!

In short I've been performing some simple experiments to get a feel for how
sockets and libev work.

- First: I've tried to open 10K sockets simultaneously. This was for me the
simplest way to verify that the kernel allows me to do that. During this
process I found that this is only possible in case the ulimit is set to a
number that is high enough. Im on Ubuntu 12.04 and I've used this to solve
the ulimit issues I initially experienced.

*In /etc/security/limits.conf
*

*<user> hard nofile 16000*
*<user> soft nofile 15000*

- Secondly: I wanted to see 15K concurrent accepted connections. I've
implemented a simple server that sets up a listening socket and an accept
handler through Libev. To feed the connections I used the Apache benchmark
tool ab as well as weighttp. To my joy I found out that almost 15K
connections were accepted, but about 5% to 10% requests did not result in
an accepted connection, without any error messages from the accept method.

After the replies I received I started looking into the queue that is used
by the listen() method. Also I implemented a client that made 15K
concurrent  requests to my server, but now very slowly. The latter resulted
in 100% acceptance, which confirmed that the pace and therefore the queue
are in fact the key to this problem.

After reading more about the listen method I found out about the backlog
parameter that controls exactly this. For most people this might be
trivial, but it was all new to me. Finally increasing this number resulted
in 100% acceptance with both ab and weighttp. This is exactly what I wanted
and it helped me to understand what is actually happening much better. So
to anyone who is at the same stage as I am w.r.t. Libev and sockets, I hope
this will be helpful for you.

Thanks again for the replies,
Marcel

On 29 Aug 2012 01:26, "Tony Arcieri" <tony.arcieri at gmail.com> wrote:

On Tue, Aug 28, 2012 at 4:23 PM, Marcel Wijnen <mmfwwijnen at gmail.com> wrote:
>
> Thanks again for th...
For posterity, can you possibly give a short post-mortem of your problem
and how you fixed it?

-- 
Tony Arcieri
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.schmorp.de/pipermail/libev/attachments/20120829/e002d742/attachment.html>


More information about the libev mailing list