ejabberd “cloud edition alpha”
Eric Cestari - cstar - May 14, 2009Objectives
It’s ejabberd, the best XMPP server, with a set of custom modules aiming for making it stateless and very scalable on the storage backend.
All state data (including user accounts, roster information, persistent conference room, pubsub nodes and subscriptions) are stored in AWS webservices, S3 or SimpleDB.
It helps scaling up and down, and keeps managing costs at a proportianal cost. AWS services are very wide, and massively parallel access is what it’s all about.
Default ejabberd configuration uses mnesia, but Process One recommends switching some services like roster or auth to ODBC when load increases.
But DBMS have their own scaling problems, and that’s yet another piece of software to administrate.
CouchDB seems loads of fun, and I’d like to put some effort running ejabberd over it later on. Some work has started, but not much progress yet. (and CouchDB is still software to one needs to manage).
Current state
ejabberd_auth_sdb: store users in SimpleDB. The version in github stores password encrypted, but forces password in PLAIN over XMPP, that means that TLS is required (really !). I have a version somewhere which exchanges hashes on the wire but stores password in clear in SimpleDB. Your call.mod_roster_sdb: roster information is stored in SimpleDBmod_pubsub: nodetree data is stored in S3 along with items. Subscriptions are stored in SimpleDB. I reimplemented nodetreedefault and nodedefault, with means that PEP works fine too.mod_muc: Uses modular_muc with the S3 storage for persisting rooms.mod_last_sdb: Stores last activity in SimpleDB
Still lacking :
Following the names of the modules, where to store data, in my opinion.
mod_shared_roster: in SimpleDBmod_vcard: VCards in S3, index in SimpleDBmod_private: S3mod_privacy: S3mod_muc_log: S3 (with a specific setting for direct serving, maybe)
These modules are the only one which have state that should be persisted on disk. Mnesia is of course still be used for routing, configuration – but that’s transient data.
Transactions and latency
We loose transactions by switching away from mnesia or ODBC. That may or may not be a problem. I think it won’t be, but I don’t have data to prove one way or the other.
Latency also grows, but erlsdb and erls3, the libraries on which the modules are built, can interface with memcached (and are ketama enabled) if you use merle. Additionally using merle will keep usage costs down.
ejabberd mod_pubsub underwent several optimizations recently, and that improved performance of non-memcached AWS mod_pubsub. Initial code had latency around 10 seconds between publishing and receiving the event. Since last week’s improvement, performance is much better.
Down the road
I’d wish to see an EC2 AMI based on this code, just pass the domain name or the ejabberd.cfg file to ec2-start-instance and boom ! you have an ejabberd server up and running.
Want more horse power ? Start another one on the same domain in the same EC2 security group, the ejabberd nodes autodiscover each other and you’ve got a cluster. ec2nodefinder is designed for this use.
Combined with the very neat upcoming load-balancing and autoscaling services Amazon Web Services, there’s a great opportunity for deploying big and cheap!
Alternatives to the AWS loadbalancing would be pen, or a “native” XMPP solution.
A few things would need to be implemented for this to work well, like XMPP fast reconnect via resumption and/or C2S/S2S process migration between servers, because scaling down is as important as scaling up in the cloud.
If you want to participate, you’d be very welcome. Porting the modules I did not write, or testing and sending feedback would be … lovely.
And of course if Process One wants to integrate this code in a way or another, that would also be lovely !
Get it
Get it, clone it, fork it ! There’s bit of documentation on the README page.
[edited : added links to XEP-0198 and rfc3920bis-08, thanks to Zsombor Szabó for pointing me to them]
Categories: Blogs Eric Cestari
Comments
Why have you put whole ejabberd source to the repository? You could just put your modules to avoid constant merging from upstream.
Posted by Anton on 15 May 2009 at 12:15I find it simpler to do the merge within git with all the ejabberd source, as it’s one command :
github pull bjc master
and another simple one to push over to my github page :
git push origin master
Can’t get any simpler. Of course conflicts may arise, but whatever the technique I use, I’d have to fix them.
Posted by cstar on 16 May 2009 at 12:47There’s a detailed follow-up to my previous comment here :
http://www.cestari.info/2009/5/16/why-fork-the-whole-ejabberd-tree
Add comment
Erlang on Twitter
» alblue (Alex Blewitt): Are OSGi services comparable to Erlang messages? Discuss.
» niclasnilsson (niclasnilsson): Love the comments! RT @jboner: LOL RT @jamesiry: Haha! “How Much Has Scala Influenced Erlang?” http://bit.ly/9Jf8sh
» manssandstrom (Måns Sandström): @peter_lind Erlang (FP) is actually simpler than java (OO), you just have to learn a few idiomatic differences. Don’t give up! :)
» Kjeld (Kjeld Kahn): Ziet dat eBay ook noSQL gaat RT @KijijiJobs: Bay Area: Backend Dev MYSQL PHP LAMP Erlang CouchDB - (SF) http://bit.ly/c2B7U9 #Kijiji #Jobs
» Dominichyland (Dominic hyland): #qcon Why so few people in erlang concurrency talk?
» rbirkby (Richard Birkby): #qcon Very surprised by how few people in the @joeerl Erlang talk
» alblue (Alex Blewitt): In the concurrency track at #qcon, up next Joe Armstrong talking about Message Passing Concurrency in Erlang
» dnene (Dhananjay Nene): @vdichev And since Java is C++ without the guns, knives, and clubs. Erlang is now C++ without ..... ;) http://is.gd/ajuFc
» ajsharp (ajsharp): Just picked up a copy of “Programming Erlang” from @pragprog. Psyched to learn a new language.
» grimborg (Òscar Vilaplana): “Erlang library&collection; of applications”,wtf is that? by Joe Armstrong,father of Erlang http://tinyurl.com/ylbnvj9
Statistics
Number of aggregated posts: 9911
Number of comments: 380
Most recent article: March 11, 2010
Latest comments
» Jens on Eleven Years of Erlang: Hi, The link to how you started with Erlang is broken. Regards, Jens
» Jeff Martens on It Made Sense in 1978: I agree that word size is machine specific, but it becomes language-specific once it’s in a language definition. In Java an …
» Adley on XP Day Suisse 2009: What a great post. What an inspiration for everyone who is asking ‘Where is all this stuff I’ve asked for?’ and …