Quantcast
Channel: Active questions tagged blazor - Stack Overflow
Viewing all articles
Browse latest Browse all 4839

How to Handle Data Inconsistency Between Asynchronous Write and Read Operations in Heterogeneous Databases?

$
0
0

I'm working on a project developed with ASP.NET, using Blazor for the frontend and Web API for the backend.

In our backend architecture, we use heterogeneous databases for read and write operations:

  • Write Database: Each service has its own private database.
  • Read Database: A data warehouse that provides pre-aggregated cross-service data.

Here's the problem:

  1. When a user performs an action on the frontend, the backend updates the write database.
  2. The response is returned to the user immediately after the write operation.
  3. The data synchronization to the read database is done asynchronously.

Due to this async process, there is a time window where the frontend might display stale data from the read database, leading to user confusion, incorrect actions, or repeated operations.

  • Directly reading from the write database to mitigate this issue is not feasible.
  • Considering a mechanism like a TraceId to track the update status and notify the frontend when the read database is updated.

Question:
What strategies can we employ to handle this inconsistency period effectively? Is using a TraceId a viable solution, or are there other design patterns or best practices that can help resolve this problem?

Any advice or suggestions would be greatly appreciated.


Viewing all articles
Browse latest Browse all 4839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>