Angie: Building Large Scale AJAX Chat System
Posted by Mickaël Rémond on March 12, 2007Ejabberd "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
- Tutorial on the new HTTP plugin API
- mod_http_fileserver on ProcessOne Development Forum
- mod_http_fileserver ChangeLog
Categories: Jabber / XMPP ejabberd
Comments
Perhaps this is a silly question, but how to scale up past one box? Would you have to use a load balancer?
Posted by Matthew Wilson on 12 Mar 2007 at 18:08Yes, of course a load-balancing mechanism is needed. It can be either a hardware of software loadbalancer. A DNS load balancer can be used in some cases.
Posted by Mickaël Rémond on 12 Mar 2007 at 18:20well connecting ejabberd and solutions like Cisco SLB (see http://www.planeta.toliman.pl/?p=12) you can build rock-solid xmpp environments (including replication of sessions between two catalyst switches based on hsrp protocol), even geographically dislocated.
Posted by Zbigniew Żółkiewski on 13 Mar 2007 at 10:37Nobody seems willing to say how far they think this can go.
Obviously you are tackling vertical scaling, what about scaling sideways? how would you tackle handling webscale deployments ( multi million )?
Howard,
We are willing to say that if you get in touch with us and you will know that we have very impressive references already.
This really depends on your project. For example, if you do not put the webscale in one domain requirements, you can use s2s (even though, ejabberd is probably one of the most scalable one domain cluster only server, if not the most scalable).
Add comment

Stay Informed
Subscribe to our RSS feed or follow us on Twitter to receive alerts when we post new news stories and blogs.
Subscribe to ProcessOne RSS feed
Follow Mickaël on Twitter
Search our blogs
To make it easier for you to find blogs on topics that you are interested in, we have grouped them into categories depending on the different themes addressed in each blog. Categories include:
ProcessOne
Jabber / XMPP
ejabberd
Erlang
CEAN
Tsung
French
Employment opportunities
IMtrends
All categories
Become a ProcessOne partner
Find out about the benefits of joining ProcessOne’s partnership programme.
Click here
Our products and services
We offer packaged solutions comprising all of the server-side and client-side technology necessary to create valuable new instant messaging applications. In addition, we offer a range of services for delivering customised solutions.
Click here for full details