[Standards] XEP-0115 redux

Peter Saint-Andre stpeter at stpeter.im
Thu Jan 17 14:45:50 CST 2008


Peter Saint-Andre wrote:

> Well we're almost there, we could just put everything in caps and be 
> done with it:

OK let's look at the numbers.

I log in and send presence with "FullCaps":

<presence from='stpeter at jabber.org/roundabout'>
   <c xmlns='http://jabber.org/protocol/caps'
      hash='sha-1'
      n='Psi'
      node='http://code.google.com/p/exodus'
      os='PPC Mac OS X Mach-O'
      v='0.11'
      ver='8RovUdtOmiAjzj+xI7SK5BCw3A8='/>
</presence>

With the addition of an 'to' address and maybe an xml:lang, that gets 
sent to all ~1750 people in my roster:

<presence from='stpeter at jabber.org/roundabout'
           to='foobar at example.com'>
   <c xmlns='http://jabber.org/protocol/caps'
      hash='sha-1'
      n='Psi'
      node='http://code.google.com/p/exodus'
      os='PPC Mac OS X Mach-O'
      v='0.11'
      ver='8RovUdtOmiAjzj+xI7SK5BCw3A8='/>
</presence>

~250 bytes * ~1750 = 437,500 bytes

But I'm going to include caps anyway. So what matters is the addition of 
the 'n', 'os', and 'v' attributes. In this example that's ~40 bytes, so 
the incremental addition is:

~40 bytes * ~1750 = 66,000 bytes

Compare that to sending an IQ-version request to the 400 people from my 
roster who are online right now:

<iq from='stpeter at jabber.org/roundabout'
     to='foobar at example.com/baz'
     id='v1'
     type='get'>
   <query xmlns='jabber:iq:version'/>
</iq>

<iq from='foobar at example.com/baz'
     to='stpeter at jabber.org/roundabout'
     id='v1'
     type='result'>
   <query xmlns='jabber:iq:version'>
     <name>Exodus</name>
     <version>0.9.1</version>
     <os>Windows-XP 5.01.2600</os>
   </query>
</iq>

That exchange is ~340 bytes. So:

~340 bytes * ~400 = 136,000 bytes

Now let's say I change my presence and that gets sent to all 400 people 
who are online (not all 1750, naturally):

<presence from='stpeter at jabber.org/roundabout'
           to='foobar at example.com'>
   <show>away</show>
   <status>brb</status>
   <c xmlns='http://jabber.org/protocol/caps'
      hash='sha-1'
      n='Psi'
      node='http://code.google.com/p/exodus'
      os='PPC Mac OS X Mach-O'
      v='0.11'
      ver='8RovUdtOmiAjzj+xI7SK5BCw3A8='/>
</presence>

That's ~300 bytes, but again the differential for n+os+v is only ~40 
bytes, so we have an incremental addition of:

~40 bytes * ~400 = 16,000

So each time I send presence I generate another 16,000 bytes. Therefore 
I would need to change presence 8.5 times during the life of my presence 
session to equal the iq:version request+response interaction that I 
would have initiated upon receiving presence from the 400 online people 
in my roster.

This puts things in a bit of a different light. I might change presence 
8+ times during a presence session, but I'd bet that most users don't do 
change presence that often. Therefore it seems to me that plunking 
n+os+v in caps is not evil from the perspective of bandwidth usage.

Plus we have caps optimization (the server can strip it out of presence 
notifications it routes after the initial broadcast), so that would cut 
down further on the notification size if people really want it. And we 
don't have that kind of optimization for iq:version.

/me ponders

Peter

-- 
Peter Saint-Andre
https://stpeter.im/

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 7338 bytes
Desc: S/MIME Cryptographic Signature
Url : http://mail.jabber.org/pipermail/standards/attachments/20080117/e0bdb9fb/attachment.bin 


More information about the Standards mailing list