How to Solve Microservice Data Dependency with Real‑Time Sync and Bifrost

This article examines the data dependency challenges among microservices in a supply‑chain system, compares initial data‑redundancy and decoupled synchronization approaches, and demonstrates how real‑time table sync using the open‑source Bifrost middleware can improve query performance and maintain consistency.

Architect's Guide
Architect's Guide
Architect's Guide
How to Solve Microservice Data Dependency with Real‑Time Sync and Bifrost

Microservices split an application into minimal units, but services often depend on each other's data.

1. Scenario

In a supply‑chain system there are three microservices—Product, Order, and Purchase—each with its own master data. The product service stores product details, while order and purchase services store orders and purchase orders respectively.

Find orders by product model, category, production year, code, etc.

Find purchase orders by the same product attributes.

Initially the product responsibilities were kept strictly in the product service. Queries involving product fields first called the product service to obtain matching product IDs, then used an IN clause in order or purchase queries.

As product count grows, IN queries become slower.

The product service becomes a bottleneck and experiences timeouts.

Timeouts cause downstream services to fail.

2. Data Redundancy Solution

Redundancy means storing selected product fields directly in order and purchase tables.

Two ways to keep redundant data consistent:

When a product is updated, call order and purchase services to update their redundant data.

When a product is updated, publish a message; order and purchase services subscribe and update their redundant data.

The first method suffers from data‑consistency problems and creates a tight dependency on the product service.

The second method avoids these issues because the product service only publishes a message, and failures in downstream updates can be handled with retry mechanisms.

3. Decoupled Data Sync Solution

Design idea:

Synchronize product‑related tables (product, category, batch, warranty, etc.) in real time to the databases of order and purchase services, keeping the schema unchanged.

Order and purchase services query the synchronized tables directly.

These services do not modify the product‑related tables.

Benefits: the product service no longer calls other services, and order/purchase services do not need to handle product data synchronization. The drawback is additional storage for the replicated tables.

To achieve real‑time sync we evaluated open‑source middleware that supports MySQL incremental sync, no custom business logic, and high activity. The comparison included Canal, Debezium, DataX, Databus, Flinkx, and Bifrost.

Bifrost was chosen because it offers a good UI, simple architecture, active maintenance, and built‑in monitoring.

4. Deployment Results

After deployment, product data synchronization remained stable. Developers of the product service focus only on product logic, while order and purchase developers simply join the synchronized tables in their queries.

The only concern is that Bifrost does not support clustering, but it has not caused downtime so far.

5. Conclusion

The article explored data dependency issues among microservices and presented a decoupled real‑time synchronization solution using Bifrost, which reduces query latency, eliminates tight service coupling, and simplifies maintenance.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

Backend ArchitectureMicroservicesdata synchronizationBifrostservice decoupling
Architect's Guide
Written by

Architect's Guide

Dedicated to sharing programmer-architect skills—Java backend, system, microservice, and distributed architectures—to help you become a senior architect.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.