Create a gist now

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Managing Data in Microservices - Notes

Link to the talk: https://www.infoq.com/presentations/microservices-data-centric

Notes:

  1. Service for each table

  2. Local/own/isolated database for each service

  3. Cache join query information locally on respective service's DBs on each write to avoid cascaded service calls (aka joins in monolithic/shared DB)

  4. Alternative to ACID transactions is to perform multi-step operations using a state machine which can be rollbacked

  5. Dealing with events
    5.1 At most once delivery - When you don't care about such events, like logging stuff using UDP
    5.2 At least once delivery - When you care about it, so it will retry if it doesn't get acknowledgment of delivery

    5.2.1 Receiving multiple times - Need consumer logic to be idempotent (which means it should yield same result if the same operation/function is performed multiple times, i.e. f(x) == f(f(x)) == f(f(f(f(x)))))

    5.2.2 Receiving out of order - Need CRDT data types (https://github.com/ericmoritz/crdt) or something, which for e.g. keeps the next one in memory for a while until the prior event is received

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment