Achieving million connections to Windows server

182 views
Skip to first unread message

Ashish

unread,
Aug 23, 2014, 4:09:34 AM8/23/14
to li...@googlegroups.com

This may not be directly related to LIBUV but like to know if at all LIBUV can help here.

I read on their blog that whatsapp guys have achieved 2 millions of concurrent connections to single server (running on FreeBSD):
http://blog.whatsapp.com/170/ONE-MILLION!
http://blog.whatsapp.com/196/1-million-is-so-2011

Makes me think FreeBSD kernel supports those many connections (or can be tweaked).

Is this possible on Windows server using LIBUV ?

Tnx,
Ashish

Ben Noordhuis

unread,
Aug 23, 2014, 11:23:55 AM8/23/14
to li...@googlegroups.com
Possibly. A lot depends on the type of traffic and the configuration
of the server.

I speculate that whatsapp clients are idle most of the time and that
perhaps 1% is active at any one time. So, with 2 million clients,
that means you have 2e6 * 0.01 = 20,000 clients that actually require
the program or the operating system do to anything in a given unit of
time. The numbers are made out of whole cloth, of course, but the
point is that their clients are zero cost most of the time.

My Core i7 can execute 10 billion instructions per second per core
without breaking a sweat. Let's assume half of that is wasted on
overhead (scheduling, bookkeeping, hardware interrupts, etc.) That
still leaves you with 1e10 / 2 / 2e4 = 250,000 instructions/sec per
client - and that's when running on a single i7 core. I will bet good
money that whatsapp a) employs beefier hardware, and b) fully exploits
every core in their systems.

Ashish

unread,
Aug 24, 2014, 12:40:58 AM8/24/14
to li...@googlegroups.com



Well, but from operating system perspective, is Windows kernel capable to accommodate and handle those many connections
(Considering factors like resource allocations in kernel per connection)? Or do we need to tweak something in there?

One opinion is that default WinSock cannot handle huge number of connections and we need install a custom socket stack that supports that many connections, but I am not sure about it.


Saúl Ibarra Corretgé

unread,
Aug 24, 2014, 5:10:33 AM8/24/14
to li...@googlegroups.com

>
> Well, but from operating system perspective, is Windows kernel capable
> to accommodate and handle those many connections
> (Considering factors like resource allocations in kernel per
> connection)? Or do we need to tweak something in there?
>
> One opinion is that default WinSock cannot handle huge number of
> connections and we need install a custom socket stack that supports that
> many connections, but I am not sure about it.
>

Not a Windows internals expert, but what you ask is nowhere related to
libuv. Iff there is a limitation in the Windows kernel you would suffer
it even if you use IOCP and Windows sockets manually.

There is no limitation in libuv itself (if that's what you asked), it's
all up to the OS.

AFAIK, Windows has a limit of 2^24 handles per process
(http://msdn.microsoft.com/en-us/library/windows/desktop/ms724485%28v=vs.85%29.aspx),
so if there is a limitation, it might on Winsock2, but I have no ides.
You might be able to find some answers on that leaked Windows 2000
source code though :-)


Cheers,

--
Saúl Ibarra Corretgé
bettercallsaghul.com


signature.asc
Reply all
Reply to author
Forward
0 new messages