Member-only story
Balancing Timeliness and Accuracy in Software Architecture
Navigating event-driven architecture for real-time updates
Recently our engineer asked me a question.
Why do we need to periodically get the latest state via API while we design the event-driven architecture, in addition to relying on asynchronous events for data synchronization?
If we need to get the latest status periodically, then why not just synchronize the data through the API completely?
This is a good question, but before answering this question, let’s consider what our system requirements are.
Suppose we want our clients to see the latest status as much as possible, and we can only allow a maximum delay of 5 minutes.
How would we design the system to synchronize the status through events? First, we would trigger a corresponding event at the point of addition, modification, or deletion of the original data, and then synchronize the state of the original data to our system based on the event. This design ensures clients can see the latest status.
On the other hand, if we need to synchronize the raw data via the API, then we must start a periodic task, such as a crontab, every five minutes, and then periodically download all the raw data back via…