Quantcast
Channel: Ignite Realtime : All Content - Openfire Dev
Viewing all articles
Browse latest Browse all 966

.toXML() Logging Overhead

$
0
0

Hi guys,

 

we have profiled our own plugin and discovered some performance issues in openfire and in the tinder library.

In both projects there are many log entries for packets. That is good, but on every call the packet.toXML() is executed, even if the log level is higher then the log method.

In our case the execution of .toXML() costs up to 80% of the execution time of handling presences.

 

i4cimgpsh_orig.png

as an example:

 

in the file:

tinder/AbstractComponent.java at master · igniterealtime/tinder · GitHub

there is the line:

log.trace("(serving component '{}') Processing presence stanza: {}",getName(), presence.toXML());

 

Possible solution:

if (log.isTraceEnabled()){

  log.trace("(serving component '{}') Processing presence stanza: {}",getName(), presence.toXML());

}

 

or better: just omit the .toXML(), so the toString() Method is called only when needed (GC: Packet - org.xmpp.packet.Packet (.java) - GrepCode Class Source )

log.trace("(serving component '{}') Processing presence stanza: {}",getName(), presence);

 

Best Regards


Viewing all articles
Browse latest Browse all 966

Trending Articles