Nktalk Case Study


Published on

The presentation covers the technical challenges which the developers faced while creating the service. Bartek Puzon explains why the Erlang language was chosen. He also describes how communication within NKtalk works and he talks about the usage of XMPP in web applications.

Published in: Technology
1 Like
  • Be the first to comment

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Nktalk Case Study

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