sourced-repo-mongo icon indicating copy to clipboard operation
sourced-repo-mongo copied to clipboard

Performance vs reliability question

Open chill-cod3r opened this issue 4 years ago • 0 comments

Are there certain considerations / concessions you would make with a data model in a situation where every single event is 100% mission critical? Specifically regarding this code:

self.events.insertMany(events, function (err) {
    if (err) return cb(err);
    log('committed %s.events for id %s', self.entityType.name, entity.id);
    entity.newEvents = [];
    return cb();
  });

Since these writes are only atomic at the individual event level, how do you handle a potential write failure with a single event in a list of events? Would this be something you'd consider self-healing with a replay? Would you programmatically trigger a replay based on a failure here? Could you mitigate this risk more by only ever writing 1 event at a time in a "message" handler?

Thanks!

chill-cod3r avatar Sep 23 '20 03:09 chill-cod3r