I’m working on a system that needs to support card transactions for a custom credit card. And event sourcing pattern seems to make sense here.
I’ve seen many examples of such patterns using dynamodb as an event store coupled with lambdas and kinesis streams to build an event driven system.
Lately I’ve been seeing QLDB which sounds like it could also fit in this pattern, probably as a replacement for dynamo. Is there any reason to consider it? Any major advantages or disadvantages to one over the other?
QLDB is an immutable database, meaning once data is there it cannot be changed and every action will be logged and can be traced (audit log). It is highly recommended for financial transactions and other data that needs to be audited without any doubt of tampering. So it is very suitable for event sourcing and it can provide reliable traceability for your data.
It sounds like a nice fit if your system records a stream of transactions to an immutable statement of record and then carries out analytical data against that ledger. I haven’t personally used AWS QLDB, but if I were you I’d be checking its flexibility around extracting specific and summated data points from the ledger for reporting and analysis.
I would also point out that DynamoDB is well tried and tested, battle proven in thousands of production solutions around the world - Dynamo is therefore pretty mature in terms of the non-functional perspective (observability, security, performance, reliability, availability etc). My guess is that Amazon QLDB hasn’t seen anywhere near that level of production adoption, so you may find its a little bit rough around some of its edges when it comes to operating it in a large-scale business-critical production environment. Comparing SLAs, Dynamo is 99.999% - 99.99% compared to QLDB’s 99.9%, but that only tells you part of the story. In any case, you should be able to easily de-risk this with a little research experimentation and testing, and if you have an AWS Solution Architect definitely bring them into the conversation.
For the time being, in QLDB you’re going to trade basically limitless throughput and ease of disaster recovery for complete immutability of the ledger. Do you have a good sense for how many TPS you’re going to need and what your RPO and RTO requirements are?
What makes it immutable exactly? It appears to have delete and update functionality. Is it just the record of actions which are immutable?
Part of a concern in a financial system is being compliant which likely means delete capabilities are required.
From QLDB intro;
With QLDB, your data’s change history is immutable – it cannot be altered or deleted – and using cryptography, you can easily verify that there have been no unintended modifications to your application’s data. QLDB uses an immutable transactional log, known as a journal, that tracks each application data change and maintains a complete and verifiable history of changes over time.
So what you see is the current state, which is a replay of your event log. You merely add events to that log and delete is one event that causes the state to change, but it does not mutate the original item itself (if I explained and guessed how QLDB works correctly)