Developing Facebook Chat: Programming Language and Technologies Used

Facebook Chat looks very simple by design, but if you pry deeper you’ll learn that it’s an impressive engineering and design feat. One must question: how was Facebook Chat, which was to serve over 70 million users when it was built (now serving over 500 million), developed? Which programming language was used to build Facebook Chat? What technologies were put together to bake this web-based chat feature? The primary Facebook chat programming language is Erlang, but that was not the only ingredient. Much more has gone into developing Facebook chat.

Eugene Letuchy, the lead developer of Chat, from Facebook, has put the answers down in a neat presentation that highlights the main aspects of what went into Facebook Chat.

Erlang at Facebook

At the heart of Facebook Chat, and thus the central part of this presentation, is a programming language called Erlang, which is a general-purpose concurrent, garbage-collected programming language and runtime system.

For the more curious among us, I’m listing below a glossary of terms – the technologies and the buzzwords – that have made Facebook Chat possible, and scalable, for over 500 million people. Most of these technologies are open source:

  • Erlang

    Erlang is a programming language used to build massively scalable soft real-time systems with requirements on high availability. Some of its uses are in telecoms, banking, e-commerce, computer telephony and instant messaging. Erlang’s runtime system has built-in support for concurrency, distribution and fault tolerance.

  • Polyglot programming

    A polyglot is a computer program or script written in a valid form of multiple programming languages, which performs the same operations or output independently of the programming language used to compile or interpret it.

  • JSONP

    JSONP or “JSON with padding” allows a page to request and more meaningfully use JSON from a server other than the primary server.

  • Using Facebook Chat via Jabber/XMPP

    To make Facebook Chat available everywhere, they are using the technology Jabber (XMPP), an open messaging protocol supported by most instant messaging software, including iChat, Pidgin, Adium, Miranda and more.

  • Hackathon

    A hackathon is an event when programmers meet to do collaborative computer programming.

  • Thrift

    Thrift is a remote procedure call framework developed at Facebook (later submitted and accepted under Apache Software Foundation) for “scalable cross-language services development”.

  • Presence

    Presence information is a status indicator that conveys ability and willingness of a potential communication partner – for example a user – to communicate.

  • JavaScript

    JavaScript is primarily used in the form of client-side JavaScript, implemented as part of a web browser in order to provide enhanced user interfaces and dynamic websites.

  • PHP

    PHP is a widely-used general-purpose scripting language that is especially suited for Web development and can be embedded into HTML.

  • Ajax

    Ajax is a group of interrelated web development techniques used on the client-side to create interactive web applications.

  • ejabberd

    ejabberd is a Jabber/XMPP instant messaging server written in Erlang. It is open source, cross-platform, fault-tolerant, clusterable and modular.

  • Polling

    Polling, or polled operation, refers to actively sampling the status of an external device by a client program as a synchronous activity.

  • Comet

    Comet is a web application model in which a long-held HTTP request allows a web server to push data to a browser, without the browser explicitly requesting it. It’s also sometimes called as Ajax Push and Reverse Ajax, among others.

  • MochiWeb

    MochiWeb is an Erlang library for building lightweight HTTP servers.

  • Scribe (note)

    Scribe is a server for aggregating log data that’s streamed in real time from clients. It is designed to be scalable and reliable.

  • FB303 (readme)

    fb303 is the shared root of all thrift services.

  • Concurrent programming

    In concurrent (parallel) programming, single tasks are split into a number of subtasks that can be computed relatively independently and then aggregated to form a single coherent solution.

  • Load balancing

    Load balancing is a technique to distribute workload evenly across two or more computers, network links, CPUs, hard drives, or other resources, in order to get optimal resource utilization, maximize throughput, minimize response time, and avoid overload.

  • Multicasting

    To transmit a single message to a select group of recipients. A simple example of multicasting is sending an e-mail message to a mailing list. Teleconferencing and videoconferencing also use multicasting, but require more robust protocols and networks.

  • Segfault

    A segmentation fault (often shortened to segfault) occurs when a program attempts to access a memory location that it is not allowed to access, or attempts to access a memory location in a way that is not allowed.

  • OOM

    Out of memory (OOM) is an undesired state of computer operation where no additional memory can be allocated for use by programs or the operating system.

  • Hot code swapping

    Hot code swapping refers to the ability to alter the running code of a program without needing to interrupt its execution. Only a few programming languages support hot swapping natively, including Pike, Lisp, Erlang, Smalltalk, and Java.

  • Symmetric Multi-Processing (SMP)

    A multiprocessing architecture in which multiple CPUs, residing in one cabinet, share the same memory. SMP systems provide scalability.


2 thoughts on “Developing Facebook Chat: Programming Language and Technologies Used

  1. Vaibhav

    Thanx for your valuable information.

    can u provide me or guide me with some code snippet for developing web based chat application using asp.net 3.5

    Regards

    Vaibhav
    9920794919

Comments are closed.