title: How did WhatsApp achieve 2 million connections per server?
body: <p>On Ubuntu, the maximum number of sockets which can be opened seems to be governed from following:</p>
  
  <pre><code>$ cat /proc/sys/net/ipv4/tcp_max_orphans
  262144
  </code></pre>
  
  <p>As per one of the presentations by Rick Reed (from WhatsApp), these guys took it up to 2 million concurrent  connections on a "single server" using FreeBSD and ErLang. My understanding is that we will always need some support from the kernel. And yes, looks like the tweaked the FreeBSD to have this <a href="http://blog.whatsapp.com/index.php/2012/01/1-million-is-so-2011/">capability</a>:</p>
  
  <pre><code>hw.machine: amd64
  hw.model: Intel(R) Xeon(R) CPU X5675 @ 3.07GHz
  hw.ncpu: 24
  hw.physmem: 103062118400
  hw.usermem: 100556451840
  
  kb@c123$ uname -rps
  FreeBSD 8.2-STABLE amd64
  
  jkb@c123$ cat /boot/loader.conf.local
  kern.ipc.maxsockets=2400000
  kern.maxfiles=3000000
  kern.maxfilesperproc=2700000
  </code></pre>
  
  <p>So, looks like kernel can be tweaked to support so many physical connections, given that we have sufficient amount of memory, correct? If yes, then it looks pretty simple, then what is the hype about it? Or I am missing something?</p>
  
  <p>Thanks.</p>