Rick Reed – WhatsApp: Half a billion unsuspecting FreeBSD users [video]
youtube.com
youtube.com
http://highscalability.com/blog/2014/2/26/the-whatsapp-archi...
The crucial mantra by Joe Armstrong is "to model a behavior in a "parallel" real world one have to choice a proper abstraction (which is about granularity, not classes or objects), then everything follows".
So they have selected a connection as a fundamental abstractions and a lightweight process as a unit of granularity. Everything else follows, indeed.
Processes share nothing, so there is no locks, semaphores, race-conditions. There is even no loops - only recursive procedures, which could be restarted if crashed, or even its code could be replaced without stopping the service (why, a new copy of the code would be called "in a next recursive call", because it is stateless/pure-functional).
Each lightweight Erlang process serves its own connection, so it is perfectly natural and efficient to block/sleep on it (the OS kernel will do the job). It is not a "busy waiting", and there are no callbacks either. No "event buses", no nonsense.
There is no threads, so no shared state or even shared stack. If a process crashes (why should it? - it communicates with outside world only via message-passing) it cannot corrupt or lock any shared data, etc. The whole class of problems which comes form a flawed concept of pthreads does not arise.
There is no "reactive asynchronous event processing (written in Java or Scala)", there is no non-blocking I/O (btw, the only real non-blocking I/O could be done by an OS - aio_read/write and friends). There is no meaningless over-abstraction. That is why it works so well. Mo magic.
A few German game studios are using it on their backends.
http://de.slideshare.net/wooga/erlang-the-big-switch-in-soci...
http://sdtimes.com/enterprises-can-learn-from-game-developme...
You could say the same about erlang for example, it used by WhatsApp and in many internet-cell network gateways.
Yahoo's FreeBSD isn't dead; YBSD! still exists too.
In the Q&A "What do you use for configuration management?" "<slight laugh> `make`", going on to say they don't have enough node types or a large enough cluster to do automation yet.
Said all that - I might be terribly wrong about everything I said, because its not an insider knowledge ;)
I think people prefer a monoculture, even though the security idea of having multiple software stacks is appealing, thoroughly testing issues on two OS stacks is a lot more work, especially at Facebook scale.
Presumably they are tied into Linux for a lot of their internal infrastructure.
In fact running multiple operating systems is more likely to lead to a misconfiguration issue which allows an attacker into your network.
Similarly one of the reasons Facebook relies on PHP is because a lot of developers are familiar with it.
I like FreeBSD but I don't think we can say that Linux can't cope with that amount of traffic while Google and Facebook use Linux. There is a missing piece here that's not about network traffic.
If I should take a guess, the advantage of the FreeBSD stack is that it is simpler and easier to understand. Hence, it is easier to tune for performance.
Go, Nodejs or Java - I'm mainly concerned about clustering, because I think that is what gave the Whatsapp devs their ability to scale(without having to do too much re-engineering).
Or can the clustering be moved to something like the queuing layer ?
There are lots of JVM implementations to choose from, many with high quality code generation (both AOT and JIT) and GC implementations.
It has VM and cluster monitoring tools only comparable by .NET offerings.
The majority of big data solutions are built on top of it.
There are lots of libraries to choose from.
If Java 8, the language, isn't your thing, there are lots of modern languages to choose from.
Java high performance clustering is... intimidating. It is too enterprisey. From my (little) research, it seems that one would need to build this ground up on top of Netty or Undertow.
Lets chant together: JVM is the best VM in the world with millions of man-hours invested in optimizations. Servlet/JSP are mature, battle-tested, enterprise-grade, type-safe solutions. NodeJS is the only way to develop high-scalable internet services. Everything must be a containerized micro-service, orchestrated by Docker/CoreOS/systemd.