NKtalk Case Study Kraków Erlang User Group 26 January 2010 Bartłomiej Puzoń,  Michał Ptaszek [email_address] Erlang Solutions Ltd
Agenda What is NKtalk? Challenges Technologies chosen Erlang XMPP Integration
What is NKtalk? nasza-klasa.pl - large Polish social networking service Over 13 mln users Service aims at being a communication platform  NKtalk is an integrated instant messaging service Provides new means of communication
Challenges Massive number of messages per second concurrent users Integration with the portal HTTP Contact lists Short time to market
Technologies chosen: Erlang What's Erlang? Functional programming language Unlike C++, Java, C# Like LISP, Haskell Open Source (www.erlang.org) Platform independent, runs on UNIX/Linux Windows Mac Embedded Systems
Why Erlang? Created for a concurrent world NKtalk: tens of thousands of users communicating simultaneously  Erlang provides concurrency based on share-nothing actors
Why Erlang? Created for a world that grows NKtalk users number grows Erlang has a built-in support for distributed applications It is easy to extend an Erlang cluster with new nodes depending on the needs
Why Erlang? Created for a networked world NKtalk is a web-based application Erlang has an extensive build-in support for TCP/IP and HTTP
Why Erlang? Created for a demanding world NKtalk requires high availability If there is an error in one of the 10.000 connections, the other 9.999 can not be affected Erlang encourages error isolation
Technologies chosen: XMPP What's XMPP? eXtended Messaging and Presence Protocol Based on XML Used for instant messaging (GoogleTalk)
Why XMPP? XMPP advantages open popular software and libraries available proven used since 1998 standarized (IETF) extensible many extensions already available
XMPP + Erlang = Ejabberd Ejabberd –  E rlang  jabber  (XMPP)  d aemon (server) Open source Modular Utilizes the aforementioned Erlang traits Successful deployments for million concurrent users
Integration: The Problem Ejabberd and other XMPP servers assume a stream-oriented connection TCP NKtalk works over the Web HTTP HTTP is a response-request protocol TCP is a stream oriented protocol
Integration: The Solution BOSH (Bidirectional-streams Over Synchronous HTTP) BOSH emulates a stream-oriented connection (TCP) over a response-request (HTTP) protocol XMPP messages that would be sent over TCP are encapsulated into HTTP request HTTP-specific mechanisms are used to emulate bidirectional connection
Overview user's web browser nktalk.pl Internet node1 Ejabberd Cluster (powered by  Erlang ) node2 node3 node4 HTTP requests
Overview user's web browser Internet Hola! XMPP stanza Hola! HTTP request XMPP stanza Hola!
Overview nktalk.pl Internet node1 Ejabberd Cluster (powered by  Erlang ) node2 HTTP request XMPP stanza Hola! BOSH module (extracts XMPP) Ejabberd Server (routes traffic) Long-term storage XMPP stanza

Nktalk Case Study

  • 1.
    NKtalk Case StudyKraków Erlang User Group 26 January 2010 Bartłomiej Puzoń, Michał Ptaszek [email_address] Erlang Solutions Ltd
  • 2.
    Agenda What isNKtalk? Challenges Technologies chosen Erlang XMPP Integration
  • 3.
    What is NKtalk?nasza-klasa.pl - large Polish social networking service Over 13 mln users Service aims at being a communication platform NKtalk is an integrated instant messaging service Provides new means of communication
  • 4.
    Challenges Massive numberof messages per second concurrent users Integration with the portal HTTP Contact lists Short time to market
  • 5.
    Technologies chosen: ErlangWhat's Erlang? Functional programming language Unlike C++, Java, C# Like LISP, Haskell Open Source (www.erlang.org) Platform independent, runs on UNIX/Linux Windows Mac Embedded Systems
  • 6.
    Why Erlang? Createdfor a concurrent world NKtalk: tens of thousands of users communicating simultaneously Erlang provides concurrency based on share-nothing actors
  • 7.
    Why Erlang? Createdfor a world that grows NKtalk users number grows Erlang has a built-in support for distributed applications It is easy to extend an Erlang cluster with new nodes depending on the needs
  • 8.
    Why Erlang? Createdfor a networked world NKtalk is a web-based application Erlang has an extensive build-in support for TCP/IP and HTTP
  • 9.
    Why Erlang? Createdfor a demanding world NKtalk requires high availability If there is an error in one of the 10.000 connections, the other 9.999 can not be affected Erlang encourages error isolation
  • 10.
    Technologies chosen: XMPPWhat's XMPP? eXtended Messaging and Presence Protocol Based on XML Used for instant messaging (GoogleTalk)
  • 11.
    Why XMPP? XMPPadvantages open popular software and libraries available proven used since 1998 standarized (IETF) extensible many extensions already available
  • 12.
    XMPP + Erlang= Ejabberd Ejabberd – E rlang jabber (XMPP) d aemon (server) Open source Modular Utilizes the aforementioned Erlang traits Successful deployments for million concurrent users
  • 13.
    Integration: The ProblemEjabberd and other XMPP servers assume a stream-oriented connection TCP NKtalk works over the Web HTTP HTTP is a response-request protocol TCP is a stream oriented protocol
  • 14.
    Integration: The SolutionBOSH (Bidirectional-streams Over Synchronous HTTP) BOSH emulates a stream-oriented connection (TCP) over a response-request (HTTP) protocol XMPP messages that would be sent over TCP are encapsulated into HTTP request HTTP-specific mechanisms are used to emulate bidirectional connection
  • 15.
    Overview user's webbrowser nktalk.pl Internet node1 Ejabberd Cluster (powered by Erlang ) node2 node3 node4 HTTP requests
  • 16.
    Overview user's webbrowser Internet Hola! XMPP stanza Hola! HTTP request XMPP stanza Hola!
  • 17.
    Overview nktalk.pl Internetnode1 Ejabberd Cluster (powered by Erlang ) node2 HTTP request XMPP stanza Hola! BOSH module (extracts XMPP) Ejabberd Server (routes traffic) Long-term storage XMPP stanza