Does Mac OS X throttle the RATE of socket creation?

Posted by pbhogan on Super User See other posts from Super User or by pbhogan
Published on 2010-05-27T15:35:04Z Indexed on 2010/05/27 15:42 UTC
Read the original article Hit count: 182

Filed under:
|
|
|
|

This may seem programming related, but this is an OS question.

I'm writing a small high performance daemon that takes thousands of connections per second. It's working fine on Linux (specifically Ubuntu 9.10 on EC2). On Mac OS X if I throw a few thousand connections at it (roughly about 16350) in a benchmark that simply opens a connection, does it's thing and closes the connection, then the benchmark program hangs for several seconds waiting for a socket to become available before continuing (or timing out in the process).

I used both Apache Bench as well as Siege (to make sure it wasn't the benchmark application).

So why/how is Mac OS X limiting the RATE at which sockets can be used, and can I stop it from doing this?

Or is there something else going on?

I know there is a file descriptor limit, but I'm not hitting that. There is no error on accepting a socket, it's simply hangs for a while after the first (roughly) 16000, waiting -- I assume -- for the OS to release a socket. This shouldn't happen since all prior the sockets are closed at that point. They're supposed to come available at the rate they're closed, and do on Ubuntu, but there seems to be some kind of multi (5-10?) second delay on Mac OS X.

I tried tweaking with ulimit every-which-way. Nada.

© Super User or respective owner

Does Mac OS X throttle the RATE of socket creation?

Posted by pbhogan on Server Fault See other posts from Server Fault or by pbhogan
Published on 2010-05-27T15:33:56Z Indexed on 2010/05/27 15:42 UTC
Read the original article Hit count: 182

Filed under:
|
|
|

This may seem programming related, but this is an OS question.

I'm writing a small high performance daemon that takes thousands of connections per second. It's working fine on Linux (specifically Ubuntu 9.10 on EC2). On Mac OS X if I throw a few thousand connections at it (roughly about 16350) in a benchmark that simply opens a connection, does it's thing and closes the connection, then the benchmark program hangs for several seconds waiting for a socket to become available before continuing (or timing out in the process).

I used both Apache Bench as well as Siege (to make sure it wasn't the benchmark application).

So why/how is Mac OS X limiting the RATE at which sockets can be used, and can I stop it from doing this?

Or is there something else going on?

I know there is a file descriptor limit, but I'm not hitting that. There is no error on accepting a socket, it's simply hangs for a while after the first (roughly) 16000, waiting -- I assume -- for the OS to release a socket. This shouldn't happen since all prior the sockets are closed at that point. They're supposed to come available at the rate they're closed, and do on Ubuntu, but there seems to be some kind of multi (5-10?) second delay on Mac OS X.

I tried tweaking with ulimit every-which-way. Nada.

© Server Fault or respective owner

Related posts about network

Related posts about Throttling