Jepsen: NATS 2.12.1

(jepsen.io)

111 points | by aphyr 2 hours ago ago

18 comments

  • vrnvu an hour ago

    Sort of related. Jepsen and Antithesis recently released a glossary of common terms which is a fantastic reference.

    https://jepsen.io/blog/2025-10-20-distsys-glossary

  • clemlesne an hour ago

    NATS is a fantastic piece of software. But doc’s unpractical and half backed. That’s a shame to be required to retro engineer the software from GitHub to know the auth schemes.

    • belter 40 minutes ago

      > NATS is a fantastic piece of software.

      - ACKed messages can be silently lost due to minority-node corruption.

      - Single-bit corruption can erase up to 78% of stored messages on some replicas.

      - Snapshot corruption may trigger full-stream deletion across the cluster.

      - Default lazy-fsync wipes minutes of acknowledged writes on crash.

      - Crash + delay can produce persistent split-brain and divergent logs

      Are you the Mother? Because only a Mother could love such a ugly baby....

      • Thaxll 26 minutes ago

        "PostgreSQL used fsync incorrectly for 20 years"

        https://archive.fosdem.org/2019/schedule/event/postgresql_fs...

        It did not prevent people from using it. You won't find a database that has the perfect durability, ease of use, performance ect.. It's all about tradeoffs.

        • dijit 9 minutes ago

          Realistically speaking, postgresql wasn’t handling a failed call to fsync, which is wrong: but materially different from a bad design or errors in logic stemming from many areas.

          Postgresql was able to fix their bug in 3 lines of code, how many for the parent system?

          I understand your core thesis (sometimes durability guarantees aren’t as needed as we think) but in postgresql’s case, the edge was incredibly thin. It would have had to have been: a failed call to fsync and a system level failure of the host before another call to fsync (which are reasonably common).

          It’s far too apples to oranges to be meaningful to bring up I am afraid.

      • cedws 6 minutes ago

        Interested to know if you found these issues yourself or from a source. Is Kafka any more robust?

      • hurturue 36 minutes ago

        do you have a better solution?

        as they would say, NATS is a terrible message bus system, but all the others are worse

        • adhamsalama 26 minutes ago

          Are RabbitMQ's durable queues worse?

  • merb an hour ago

    > 3.4 Lazy fsync by Default

    Why? Why do some databases do that? To have better performance in benchmarks? It’s not like that it’s ok to do that if you have a better default or at least write a lot about it. But especially when you run stuff in a small cluster you get bitten by stuff like that.

    • aaronbwebber 18 minutes ago

      It's not just better performance on latency benchmarks, it likely improves throughput as well because the writes will be batched together.

      Many applications do not require true durability and it is likely that many applications benefit from lazy fsync. Whether it should be the default is a lot more questionable though.

    • thinkharderdev an hour ago

      > To have better performance in benchmarks

      Yes, exactly.

    • millipede 30 minutes ago

      I always wondered why the fsync has to be lazy. It seems like the fsync's can be bundled up together, and the notification messages held for a few millis while the write completes. Similar to TCP corking. There doesn't need to be one fsync per consensus.

  • rdtsc 27 minutes ago

    > By default, NATS only flushes data to disk every two minutes, but acknowledges operations immediately. This approach can lead to the loss of committed writes when several nodes experience a power failure, kernel crash, or hardware fault concurrently—or in rapid succession (#7564).

    I am getting strong early MongoDB vibes. "Look how fast it is, it's web-scale!". Well, if you don't fsync, you'll go fast, but you'll go even faster piping customer data to /dev/null, too.

    Coordinated failures shouldn't be a novelty or a surprise any longer these days.

    I wouldn't trust a product that doesn't default to safest options. It's fine to provide relaxed modes of consistency and durability but just don't make them default. Let the user configure those themselves.

    • CuriouslyC 5 minutes ago

      NATS data is ephemeral in many cases anyhow, so it makes a bit more sense here. If you wanted something fully durable with a stronger persistence story you'd probably use Kafka anyhow.

  • maxmcd 22 minutes ago

    > > You can force an fsync after each messsage [sic] with always, this will slow down the throughput to a few hundred msg/s.

    Is the performance warning in the NATS possible to improve on? Couldn't you still run fsync on an interval and queue up a certain number of writes to be flushed at once? I could imagine latency suffering, but batches throughput could be preserved to some extent?

    • scottlamb 13 minutes ago

      > Is the performance warning in the NATS possible to improve on? Couldn't you still run fsync on an interval and queue up a certain number of writes to be flushed at once? I could imagine latency suffering, but batches throughput could be preserved to some extent?

      Yes, and you shouldn't even need a fixed interval. Just queue up any writes while an `fsync` is pending; then do all those in the next batch. This is the same approach you'd use for rounds of Paxos, particularly between availability zones or regions where latency is expected to be high. You wouldn't say "oh, I'll sync and then put it in the next round of Paxos", or "I'll wait until the next scheduled round"; you'd just batch while the previous is going.

  • gostsamo an hour ago

    Thanks, those reports are always a quiet pleasure to read even if one is a bit far from the domain.