[AWS] Having more then 1000 concurrent connections?

R. Tyler Croy tyler at monkeypox.org
Wed Aug 24 08:20:33 CEST 2011


On Wed, 24 Aug 2011, Thomas L?cke wrote:

> On Wed, Aug 10, 2011 at 10:53 AM, Pascal Obry <pascal at obry.net> wrote:
> > 3000 connections means 3000 tasks (so threads). Each threads has its own
> > stack, on 32bits OS this will just too much threads for the available
> > stack size. Even for a quite heavy loaded server a max connection of 100
> > and a queue size of 3000 should be ok.
> 
> 
> Is there actually any gains at all by having max connection set > than
> the amount of CPU cores available? I mean, if you've got 8 cores,
> won't a ninth AWS task just sit around waiting until on of the cores
> are available? Or am I missing something?

You're missing the purpose of the OS level scheduler. If each of your tasks is
heavily CPU-bound, then yes your assumption is correct. The majority of
requests do a little bit of CPU (template rendering), a little bit of network
I/O (hitting DB, etc) and maybe a little bit of disk I/O (serving up a file).
It's the OS scheduler's job to interleave this in the most efficient way
possible.

FWIW, your assumption is also correct if you're using something like node.js or
eventlet, where there is an event loop of some kind that implements coroutines
in userland. In effect, I would run 1 node.js instance per core of my machine
to acheive maximum performance, since the libev loop underneath it all handles
swapping tasks that are waiting on I/O (for example).


> Hmmm, this sounds like something that's worth benchmarking, and
> perhaps write a small article about!

IMHO finding a good max connection/task limit is very application dependent.



Welcome back from the vacation :)

- R. Tyler Croy
--------------------------------------
    Code: http://github.com/rtyler
 Chatter: http://identi.ca/agentdero
          http://twitter.com/agentdero
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
Url : /pipermail/aws/attachments/20110823/704fffd7/attachment.pgp 


More information about the AWS mailing list