[jdev] Collaboration on BOSH servlet?

Greg Wilkins gregw at mortbay.com
Wed Jan 9 15:57:13 CST 2008


Stefan Strigler wrote:

>> What is the state of the art with regards to XMPP/BOSH servlets.
>> Googling reveals a somewhat
>> confused and perhaps dated picture?
> 
> AFAIK there's only my 'JabberHTTPBind' servlet. It's hosted at
> http://zeank.in-berlin.de/jhb/. It implements most of the BOSH spec but
> not all IIRC. But I'm pretty sure it won't scale up to 20.000 users :D 


Hi Stefan,

It's a pity that JabberHTTPBind is GPL, as I do most of my work under
apache-2.0 and there are some issues mixing and matching.   So eventually
it would be good to have an apache 2 licensed version of the same thing.

However, I'd be happy to work with you to make JabberHTTPBind asynchronous
(and thus scale better) while I get around to re-inventing the wheel under
a different license (dang I hate legal stuff).

The key thing to change with your servlet is the sess.sock.wait();
waiting in servlets is expensive as it holds a thread, buffers and other
resources.   The idea is to replace the wait with suspend/resume semantics.

We have suspend/resume in Jetty now and there is a proposal to include
it in Servlet 3.0.  Actually, it is probably worthwhile waiting a month
so JSR-315 has time to make some progress in deciding if suspend/resume
will be support... then you can move towards the future standard.

My other concern with scalability is the use of a DocumentBuilder that
will create lots of Dom objects on each and every request that will need
to be garbage collected.  Specially as it looks like it may parse the
message bodies as well, even though they are simply forwarded on.

I think the creation of a special purpose parser that can go over
<body ...>...</body> and extract just the bits needed for the protocol
would be well worth the effort.  Ideally this could work asynchronously
on partial content.  Perhaps this is what I can start work on, because
if I write this as apache-2 licensed, then you could use it (if you
wanted to) in GPL code.

cheers












More information about the JDev mailing list