[JDEV] Request for comments on system using jabber
David Waite
dwaite at jabber.com
Fri May 25 10:50:56 CDT 2001
On Thu, 24 May 2001, Thomas Charron wrote:
> From: Jens Alfke
> Subject: Re: [JDEV] Request for comments on system using jabber
> On Thursday, May 24, 2001, at 10:23 AM, Todd Bradley wrote:
> Jabberbot's roster on Jabber.com is about 10 times the size of the
next
> largest user's roster. Whenever Jabberbot tries to log in now, it
causes
> all kinds of server mayhem because every presence change causes the
server
> to go read and parse rosters of everyone in Jabberbot's roster. This,
and
> the subsequent traffic backups, crash the server at Jabber.com
> I don't mean to sound snotty, but: This demonstrates a
> performance/scalability issue with the server (not to mention an
outright
> bug if it actually crashes), not a reason not to use presence for this
> purpose.
> How large is that roster? If Jabber isn't scalable to this level, it
may not
> yet be ready for widespread use. (Consider a mail server that crashed
if you
> tried to send a message to more than 100 people at a time.) There is a
very,
> very large degree of interest in the industry right now for exactly
these
> sorts of IM bots.
IMO, mailservers should break if you try to send to more than ~20 people
at a time. Not crash, but refuse to send. Jabber should probably work
the same way in this case (200 users max in a roster or something
configurable like that)
Hypothetically, if you had a 10,000 user roster, that would generate
about 5 MB of XML traffic through the server it was running on everytime
the bot came online. This depends a bit on the length of the average
JID, but the same amount of information is sent whether the user is
online or not. Even if all of those users are on the same machine, that
would be 10,000 user rosters it would have to load up via XDB and parsed
(since the roster is also basically the presence ACL). If the server
wasn't intelligent, you would also have the converse - any time one of
those 10,000 users changed their status to 'away' or went on or offline,
it would have to load and parse a megabyte XML document.
Now imagine this is a portal with a quarter of a million users, and the
bot is added by default to everyone's roster. Not only would that roster
be about 25MB, there would be at least a 35MB memory image for the DOM
tree created. The restarting of that service would cause 150 MB of
traffic to be routed through the server (25 MB going outside the local
network), and a 35 MB roster structure would be resident on the server.
Finally, your 250,000 user roster will be run through for every presence
change on the server (since every user has the bot in their roster). The
0.25 million node XML structure in memory is a linked list, so this
would equate to a worst-case 250,000 string compares as it walks a
quarter-million node list. Finally, at least the open source server
implementation will cache presence for local users while they are
online. 250,000 - 500,000 cached entries, all XMLNodes, for a
guesstimated worst-case size of about 250 MB server memory for the bot
to just be online.
Moral of the story: if you try to solve every problem with a hammer and
a crowbar, you just end up breaking a lot of things ;-)
-David Waite
More information about the JDev
mailing list