Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
-
None
-
None
-
C++ reactive binding
Description
The C++ binding has become several times slower over time.
Investigating this performance degradation yields the following
observations.
Creating and destroying some Proton C objects is expensive.
A pn_data_t requires 7 separate malloc and free calls.
A pn_message_t requires almost 60 (there are 7 pn_data_t members in a
pn_message_t)
The cost set-up and tear down can exceed the use cost, so re-use can
provide a serious performance win.
As a corollary, no Proton object should be included in a C++ messaging
event for the 'just in case' scenario, since so many are ignored by
the application.
Sample performance numbers for loopback messages on a 4 core 8 thread laptop:
62,000 msgs/sec: unused message per event, except during on_message (current code)
135,000 msgs/sec: lazy message creation and destruction at on_message
190,000 msgs/sec: re-use pn_message_t object for all inbound messages on a connection