Skip to content

Persistence Opt out

Romain Verdier edited this page May 12, 2015 · 11 revisions

The Persistence system allows for a safer way of sending messages, but it comes at a cost, it impacts performance. While it will still be possible to send tens of thousands of messages per second, persistent messages imply sending twice as much messages on the network, which is not free.

So when a user needs the extra performance and can afford to lose a message (which only happens in rare occasions, since we rely on TCP), it is possible to disable the Persistence system.

Message level

By decorating a message class with the Transient attribute, it is possible to disable the Persistence mechanism for a specific message. This way a copy of the message won't be sent to the Persistence Service when it is sent, and the receiving Peer won't acknowledge processing it.

Peer level

When starting its Bus, a Peer can set the IsPersistent property in the Bus configuration (off by default if using the BusFactory). If the property is set to false, the messages sent to this Peer won't be sent to the Persistence.

Summary

In order for a Message to benefit from the Persistence feature, it must not be decorated as Transient AND the receiving Peer needs to be Persistent.

Message marked as persistent Message marked as transient
Service marked as persistent ✔️ persisted ✖️ not persisted
Service marked as transient ✖️ not persisted ✖️ not persisted