Whatsapp is an American freeware, secured cross-platform messaging and Voice over IP (VoIP) program that was initially released in January 2009 and was later acquired by Facebook in 2014. It was founded by Jan Koum and Brian Acton. Users are able to send text messages, and voice messages, participate in conversations, make audio-video calls, and exchange documents, media, and other files with other users, either individually or in groups.
You are interested in learning more about the technology stack that Whatsapp employs because it is one of the most popular messaging apps. Then you have come to the correct spot because, in the upcoming sections, I will describe the technology stack that WhatsApp uses.
WhatsApp Technology Stack
- Facebook Data Center
Php is an open-source, free server-side scripting language built for developing websites and web applications. It stands for "PHP: Hypertext Preprocessor".
XMPP protocol is widely used by Whatsapp for the instant messaging backend. It stands for "Extensible Messaging Presence Protocol".It's a protocol similar to HTTP where the client establishes a connection with the XMPP Server and keeps it open for as long as the client is logged in. Like REST API, it does not close the socket after the socket sends/receives the data is completed. Socket opens connection as long as you are signed in.
XMPP uses TCP/HTTP/Websockets as the transport binding.
Ejabberd is an application server and an MQTT broker that is primarily built in the Erlang computer language. It is based on the XMPP protocol. It is compatible with a variety of operating systems that are based on the Unix kernel, including macOS, Linux, FreeBSD, NetBSD, OpenBSD, and OpenSolaris.
Ejabberd has a number of useful features, some of the most significant of which are one-on-one chatting, group chat, storing and forwarding offline messages, contact lists and presence, and so on.
In order to handle hundreds of millions of heavy-duty, Whatsapp uses Mnesia. Mnesia is a multi-user distributed DBMS built in Erlang. Mnesia's key benefit is that it "can be held coherently on the disk and in its memory" in the persistence sense. This helps to get quick request time.
Because WhatsApp has a huge volume of call setups, it is almost hard for these data to be written to the disc. Mnesia assists with this challenge because of the volume of traffic WhatsApp generates. Mnesia is defined by the fact that it "may be coherently preserved on disc and in the main memory," in terms of its persistence. This assists in achieving faster response times to requests.
FreeBSD is a free and open-source operating system built on top of the Unix Operating System. Among many OS of Berkeley Software Distributions(BSD), FreeBSD is one of the most popular OS distributions used to power desktops, modern servers, and embedded platforms. We can take FreeBSD as an excellent performance OS. It is like Linux because it shares many similarities with it. It has better security than Linux.
Yaws(Yet another webserver) is a high-performance multithreaded web server entirely written in Erlang. generally suited for dynamic content web applications.
It can be used in 2 modes :
1) Standalone Mode: Here, Yaws performs like the regular standalone regular webserver.
2) Embedded Mode: Here, Yaws runs as an embedded webserver in other Erlang-based applications.
Yaws has good performance under high concurrency because Yaws uses Erlang's Lightweight threading system. It can work efficiently with any database.
Facebook Data Center
Whatsapp used to run in IBM SOFTLAYER cloud, an independent cloud hosting company but later shift to Facebook's own Data Center.
Ans: The VoIP service, also known as Voice over Internet Protocol, is what makes the Whatsapp Internet Calling function possible.
Everything you say is first turned into a series of packets, then sent to the recipient by way of a server, and is only put back together after it arrives at its destination. It's very much the same as sending an email or a message.
Ans: WhatsApp uses Erlang as a backend programming language. Erlang seems to be much more agile in adapting for hotfixes and instant updates.
Ans: Yes WhatsApp uses an XML layout. It contains 2 XML Layouts respectively for the incoming and outgoing audio messages.
Ans: WhatsApp uses different TCP and UDP ports. Some of the TCP ports used are TCP 40, TCP 443. Some of the UDP ports used are 34784, 50318, etc.
Ans: If the application needs to handle a large number of concurrent messages, if the application needs to be scalable and easily distributable over a network etc then Erlang is one of the suitable choices. But other languages like Php, Java, .Net, nodejs are also good at it. It's their choice.
Ans: A db.crypt12 file is a WhatsApp Messenger database file. The encrypted chat message history of the users is stored here. WhatsApp uses it to encrypt a user's message on an Android device.