Angie: Building Large Scale AJAX Chat System

Ejabberd “Angie” is our internal codename for the next version of the High-Performance Instant Messaging server (See our previous post presenting Angie).
The next version is going to offer a High-Performance HTTP server, for convenience and scalability purpose. It will both help the deployment of in-browser, AJAX-based chat solution but also will make it able to sustain an extremely high loads.

The problem: deployment and scalability issues

Many ejabberd system administrators have always wanted to have a simpler way to deploy AJAX based chat tools on top of ejabberd.

The difficult part is a well known Javascript security limitation. The main characteristics of XMPP AJAX based chat tool is that you need to have the URL for the HTTP polling or HTTP binding protocol to be on the same domain that the code of the AJAX tool itself. In practice, this means that you need to use Apache as a proxy, to deploy an AJAX tool like JWChat on your website (See ejabberd with JWChat tutorial).

This approach have several drawbacks. It makes the whole system pretty complex to deploy as you need to configure and operate two
components. It also make the system less scalable: It is not a problem for ejabberd to handle thousands of HTTP polling or binding
simultaneous connections, but it quickly become a problem for the Apache proxy, that cannot sustain such a high load.

The solution: serve AJAX code with a high-performance HTTP server inside ejabberd

The solution is to provide an all-in-one solution by making ejabberd able to serve the code of the chat system through the HTTP protocol.

For this reason, we have developed a new ejabberd module called mod_http_fileserver whose purpose is to serve content throught
HTTP. This module use our new development API for HTTP plugins.

The result is a full-featured, highly maintenable, easy to deploy high-performance AJAX chat system.

Quick benchmarks

A simple benchmark shows that this basic HTTP file server does scale very, very well. You can easily serve thousands of simultaneous users on a laptop. As a comparison, a Tomcat container can usually only serve between 50 to 500 simultaneously connected users.

In a simple test using Apache Benchmark (ab), the ejabberd mod_http_fileserver module was able to serve 4000 requests per seconds, on a small 100 bytes file. The test machine was a simple MacBook Pro Intel laptop. We also tried a simple Tsung HTTP benchmark. On the same hardware, we reach 6000 simultaneous users, serving a maximum of 1500 requests per second in our scenario. As you can see, all those
new developments are really high-performance.

A High-Performance AJAX Chat System

What we describe here is of course the approach we are using to deploy OneTeam, our rich web client, on customers’ sites.

Now, if you want to build a large scale and high-performance AJAX chat system, you know that ejabberd is probably your best choice. This new
development does provide you another reason to try ejabberd if you have not yet been selected it as your platform of choice.

Technical references


Let us know what you think 💬

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.