Direct vs guaranteed messages

JiriP
JiriP Unconfirmed, Member Posts: 2

Hi, we are considering options for streaming a sequence of messages from one consumer to another.
Our main requirement for this stream is to guarantee that we do NOT LOSE messages in the middle of the stream. Reading through Solace doc's its not really clear enough to me how could we accomplish this with as small performance penalty as possible.

What I understood from docs is that Direct messaging can basically drop any message any time. How likely is this situation? And is there some mechanism how to reliably detect this situation (outside of implementing our own sequence numbering and checking)? Or should we rather go the Guaranteed messages way? We are a bit afraid of degraded performance because of persisting messages, sending full acks etc. Or can these features be somehow "tuned" for our purpose?

Thanks.

Comments

  • hong
    hong Guest Posts: 480 ✭✭✭✭✭
  • TomF
    TomF Member, Employee Posts: 406 Solace Employee

    Hi @JiriP, this is a great question. At first glance the choice between direct and guaranteed feels like it should be obvious, but the more you dig in to it, the less obvious it becomes.

    I would generally say that "DO NOT LOSE" in capital letters is a good indication that you need guaranteed. But let's talk about when you might discard messages with direct:
    1. If the consumer is off line. There's no persistent storage with direct, so if your consumer isn't listening, the messages sent during this period aren't available when the consumer does come on line;
    2. If the consumer is slow. If the consumer can't keep up with the message rate, at some point something (in this case the broker) runs out of buffer space and messages will be discarded.
    3. There's a temporary disruption. Two examples of this are a network issue that forces disconnection or a broker HA failover. In the network issue example there is only so much TCP can correct for - eventually it looks like the consumer can't keep up with messages and so discards occur. In the broker failover case, without the guarantees of... well, guaranteed messaging, it is likely the consumer will miss messages when reconnecting.

    Another way to think about this is how can you detect and recover from a lost message? Can you, say obtain a snapshot from a cache? The broker will tell you if it has discarded messages (see discard indication) but it isn't foolproof - the only truly 100% accurate loss detection mechanism is producer sequence numbering.

  • arih
    arih Member, Employee Posts: 125 Solace Employee

    On top of Tom's great notes, I'm curious on your performance requirements. Guaranteed will give you relatively lower throughput compared to direct, but if it's still higher than your requirement then there's no problem right?
    Take a look here for an idea of how much throughput you'll get for direct and guaranteed for few scenarios: https://solace.com/products/performance/

  • JiriP
    JiriP Unconfirmed, Member Posts: 2

    Actually, we want to prevent losing messages but we're fine with it as far as we can detect the situation. And we do not need any other guarantees or persistence. So, using direct messaging together with "discard indication" seems like a way to go for us... Thanks for your answers! They have been very helpful.

  • TomF
    TomF Member, Employee Posts: 406 Solace Employee

    @JiriP excellent! It sounds like you really understand the problem and the options available.