views:

129

answers:

1

I'm trying to build a server that will handle many concurrent connections to iPhone clients without multi-threading. I will be sending messages to all clients approximately every 10-30 seconds, but most messages will be identical or very similar and easy to sort. Given the setup of high-concurrency but low need for data sorting, I am trying to find the best solution for my server setup.

I've been looking at event-driven packages such as EventMachine, Twisted, node.js etc. It seems that Twisted and EventMachine are basically a toss-up, and node is probably faster but also not quite ready for full development. That leads me to a few questions:

  1. Is Node unfit for critical development simply because it's API's are lacking and it is not fully flushed out? Or might there be bugs that will make my development hell?

  2. I'm considering writing the code in C, since there will be very little disk I/O and most of it should be easily cached. If so, it seems I should use non-blocking UDP sockets and handle the ACKing myself. I've looked at poll(), select(), epoll(), but am having a hard time determining which is best and how exactly to invoke them. Any thoughts?

  3. If I use Twisted or EventMachine (is there a difference other than language? I don't know either yet, so I'm a blank slate), should I try TCP or UDP? Could these languages handle sending 1kB to 10,000 clients in less than a second?

I'd appreciate any insight/suggestions, right now I'm spinning my wheels madly around too many documentations and blogs, and don't have the programming background to sort through it (at least with any sanity left).

Thanks! Mike

+3  A: 

I suggest you to develop your server in C on Mac OS X snow leopard, using kqueue() and kevent() or kevent64() to multiplex incoming client connections.

Take a look at the freely available source code of IRC servers. These servers handle even more than 10K clients concurrently.

Start reading this page. Even though it is a bit outdated, it is still a good reference to start with.

unforgiven