TL;DR
This paper dives deep into evaluating various data enrichment methods for Distributed Stream Processing (DSP) systems, a crucial component for real-time data analysis. They identify key use cases and benchmark different techniques like synchronous/asynchronous queries, caching, and embedded state, finding that asynchronous methods and caching offer significant advantages for latency-critical applications.
What Problem Does This Paper Address?
Modern applications are awash in data from sources like IoT devices and business intelligence platforms. To make sense of this deluge in near real-time, Distributed Stream Processing (DSP) systems are essential. However, raw data streams often lack the context needed for meaningful analysis. This necessitates "data enrichment," where external information is added to the stream. The challenge is that this enrichment process can introduce significant dependencies and performance bottlenecks, especially in cloud environments where resources need to be managed efficiently. This paper aims to systematically evaluate different data enrichment strategies to guide practitioners in choosing the most suitable method for their specific use cases.
Methods
The authors tackle this problem by first categorizing data enrichment use cases based on data availability, volume, and time sensitivity, leading to categories like "Simple Queries," "Complex Queries," and "Finite Data Sources." They then implement and evaluate several data enrichment methods within a realistic cloud infrastructure using Apache Flink as the representative DSP system. The methods explored include:
- Datasource Clients:
- Synchronous: Directly querying external data sources for each event.
- Asynchronous: Using asynchronous clients to query external sources in parallel, improving efficiency.
- Caching:
- Local Caching: Storing a subset of external data within the DSP system's worker nodes.
- External In-Memory Database Cache (Redis): Using an external cache like Redis for faster access.
- Embedded State: Loading the entire external dataset into the DSP system as a stream and performing joins.
They also investigate the performance of embedding Machine Learning (ML) models directly within Flink for log analytics.
Datasets
The paper does not explicitly mention using pre-existing, named datasets for training. Instead, they generate synthetic data for their use cases:
- Fraud Detection Use Case: Generates credit card transaction events with details like transaction information, device information, and location. Historical data for enrichment is stored in a Cassandra database.
- Log Analytics Use Case: Generates log events with service origin, message content, and timestamps. Pre-trained ResNet models (ResNet-18 and ResNet-101) from the ONNX community are used for ML model enrichment, with models fetched from Google Cloud Storage.
The paper introduces a realistic cloud infrastructure setup on Google Cloud Platform (GCP) as their benchmark environment, which includes Kafka for messaging, Cassandra for external data storage, Redis for caching, and Prometheus for monitoring.
Key Insights and Ideas
- Asynchronous is Generally Better: For external data source queries, asynchronous clients consistently outperform synchronous ones in terms of latency and resource utilization, especially under high throughput.
- Caching is Crucial for Performance: Caching external data significantly reduces latency and improves throughput compared to direct asynchronous queries, particularly when dealing with frequently accessed data.
- Local Caching vs. External Caching: Local caching within the DSP system offers better latency and cache hit rates than external caches like Redis, but it places a higher load on the DSP system's resources. External caches, while potentially slower, offer better resilience against TaskManager failures.
- Embedded ML Models Have Trade-offs: While embedding ML models can reduce latency by avoiding external service calls, it introduces significant memory management challenges and can lead to JVM Garbage Collector issues and TaskManager crashes, especially with larger models.
- State Management Matters: The amount of historical data managed by the DSP system's state backend directly impacts latency; more data generally means higher latency.
Key Results
- Fraud Detection:
- Asynchronous Cassandra queries showed significantly lower and more stable latency than synchronous queries, with synchronous queries experiencing a dramatic latency increase beyond 1900 events/s.
- Caching methods, particularly local caching with a custom partitioner, achieved near 100% cache hit rates and the most stable latencies.
- Asynchronous enrichment without cache had volatile latency, ranging between 3.3s and 3.5s.
- Log Analytics:
- Embedding ML models (ResNet-18 and ResNet-101) directly in Flink resulted in latency spikes when caches were cleared (every 4 minutes), attributed to ONNX session creation time.
- ResNet-101, being larger, had significantly longer session creation and prediction times compared to ResNet-18.
- The paper highlights that while embedded ML is feasible, current DSP frameworks might not be fully optimized for such memory-intensive workloads.
Limitations and Future Work
- Limitations:
- The paper acknowledges that outsourcing data to a cache is not always feasible due to complex database queries or data structures.
- The performance of embedded ML models is limited by memory constraints and JVM garbage collection, suggesting that current DSP frameworks may not be fully optimized for these workloads.
- The latency measurement for the fraud detection use case, while custom, does not account for all waiting times within the streaming platform.
- Future Work:
- Developing dynamic caching mechanisms that adapt to source access speeds and varying workloads.
- Exploring GPU acceleration for data enrichment.
- Investigating serverless computing approaches for stream processing enrichment.
Summary updated