Aggregating Cache for Real-Time Stream Consistency
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Conventional message queues face challenges in handling out-of-order and duplicated events in high-update database write scenarios, leading to performance issues and a tradeoff between reliability and consistency.
Innovation Solution
A consistency mitigation system that employs a snapshot identifier with a timestamp, machine identifier, and sequence counter to ensure total ordering, and an aggregating application layer that batches and aggregates message objects before writing to the database, mitigating out-of-order and duplicate messages.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Reliability
If message queues use guaranteed delivery with acknowledgements to ensure reliability, then data consistency is improved, but out-of-order and duplicated messages occur causing performance degradation
Solution Approach 1:
The patent applies preliminary action by pre-processing messages in an application layer before they reach the database. The system batches similar messages together and processes them in advance, transforming individual message handling into batch operations. This preliminary batching resolves the contradiction by preparing data in advance to prevent out-of-order and duplicate write issues while maintaining guaranteed delivery semantics.
Solution Approach 2:
The patent introduces an intermediary application layer between the message queue and the database. This intermediary batches messages, determines their final order, and consolidates duplicate writes before passing data to the database. The intermediary resolves the contradiction by acting as a buffer that maintains reliability through batching while improving performance by reducing the total number of database operations.
2Speed
If the system processes messages in real-time with immediate database writes, then data freshness is improved, but out-of-order and duplicate messages cause consistency issues
Solution Approach 1:
The system performs preliminary batching and ordering of messages in the application layer before database insertion. By pre-determining the final order of messages and consolidating duplicates before writing, the system maintains data consistency while enabling faster batch commits to the database, thus resolving the contradiction between speed and reliability.
Solution Approach 2:
The patent merges multiple individual message operations into consolidated batch operations. By combining similar messages and processing them together in a single database transaction, the system achieves both speed (through reduced I/O operations) and reliability (through atomic batch commits that prevent partial updates), resolving the contradiction between data freshness and consistency.
3Productivity
If the system increases database write frequency to handle high-traffic scenarios, then real-time processing capability is improved, but the number of database reads and consistency maintenance increases causing performance issues
Solution Approach 1:
The patent merges multiple individual database write operations into consolidated batch operations. By accumulating messages in batches and writing them together, the system reduces the total number of database transactions, thereby decreasing the cumulative read time and improving overall performance while maintaining real-time processing capability through efficient batch commits.
Solution Approach 2:
The system performs preliminary batching and consolidation of messages before database writes. This pre-processing in the application layer reduces the frequency and volume of database operations, thereby reducing the time spent on database reads and consistency checks, while still maintaining the ability to process high-traffic scenarios in near real-time.
Data Source
AI summary
Aspects of the present disclosure include a system comprising a machine-readable storage medium storing instructions and computer-implemented methods for consistency mitigation in real-time streams. Consistent with some embodiments, the method includes reading a message object from a message queue and adding the message object to an aggregating cache. The aggregating cache includes a linked list of ordered message objects. The method further includes applying an aggregating function to the message objects in the linked list and persisting the aggregated message objects to a database. The method further includes clearing the message objects from the aggregating cache based on the message objects being persisted to the database.


