Comment 10 for bug 1591399

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote : A change has been merged

Reviewed: https://review.opencontrail.org/21033
Committed: http://github.org/Juniper/contrail-controller/commit/1331357f86b8db158507d2759c9f5b421a7a32fa
Submitter: Zuul
Branch: master

commit 1331357f86b8db158507d2759c9f5b421a7a32fa
Author: Nischal Sheth <email address hidden>
Date: Tue Jun 7 15:29:49 2016 -0700

Optimize build of xmpp udpate messages

Sending a set of routes to multiple xmpp peers becomes quite expensive
if some of the peers get blocked. The same route has to be encoded in
xml string format multiple times. Alleviate this by caching the string
representation in the RibOutAttr and using it if available. The xml
string is cached only if there are one or more blocked peers in RibOut
i.e. only if it's going to be used later on when building another xmpp
message.

It's quite common to build an xmpp message and send to multiple peers.
String operations to build a new message with a different to attribute
are pretty expensive. Reuse the same message by selectively replacing
the first line.

Need to hand code xml generation for message, event and items to achieve
the above. However, those are pretty static - xml for each item is still
generated by building a document and calling pugi library print method.
Use a custom xml_writer to append to string representation of message.
This helps avoid unnecessary intermediate steps of writing to a stream
and converting the stream to a string.

Add test code that was used to characterize behavior and identify some
of the bottlenecks.

Pending:

- Handle corner case where the peer name is very long
- Tweak code to avoid trailing whitespace on the first line

Change-Id: I29eb55561d969fc9807cafa894a7fc64658d17d4
Partial-Bug: 1591399