Rakesh Gupta
5 min readNov 13, 2024

Simplifying Real-Time Batch Ingestion: Streamlining with Databricks and Kafka for Better Performance and Manageability

As data processing architectures continue to evolve, there’s a growing need to refine them for efficiency, cost-effectiveness, and simplicity. Recently, our team undertook the task of simplifying an outdated architecture designed for real-time batch ingestion using Kafka, Azure Functions, Event Hubs, and Event Hub Capture. Through a careful re-evaluation of these resources and processes, we replaced this setup with a more streamlined architecture that leverages Databricks to directly ingest data from Kafka into a data lake.

This article delves into why we chose to make this transition, the details of our updated architecture, and the tangible benefits from both a business and technical perspective.

The Problem with the Old Architecture

In our previous setup, real-time data ingestion was complex and resource-intensive. It looked something like this:

  1. Data Streams from Kafka: Kafka streams would be ingested using Azure Functions to preprocess data.
  2. Azure Event Hubs: The data would then be sent to an Event Hub for ingestion, requiring Event Hub Capture to transfer data to storage.
  3. Azure Data Lake: From Event Hub Capture, data was ultimately stored in an Azure Data Lake for downstream data transformations.

While functional, this architecture presented two major challenges:

  • Resource Complexity: Multiple Azure resources were required to achieve seamless data flow, which meant higher management overhead, increased costs, and more points of potential failure.
  • Architectural Inefficiency: Using multiple Azure components created latency and complexity in the ingestion process, particularly with Event Hub and Event Hub Capture, which added steps without significant value.

A Fresh Approach: Simplifying with Databricks and Kafka

To overcome these issues, we simplified the architecture, retaining the core function of real-time data ingestion but eliminating redundancy. Our new architecture is as follows:

  1. Kafka as the Direct Source: Kafka now serves as the single source of streaming data.
  2. Databricks Direct Ingestion: We connected Databricks directly to Kafka for data ingestion, bypassing Azure Functions, Event Hub, and Event Hub Capture entirely.
  3. Data Lake Storage: Databricks now writes the ingested data directly to Azure Data Lake for storage and downstream processing.

By removing intermediary components and integrating Kafka directly with Databricks, we’ve managed to create a streamlined, efficient, and cost-effective data ingestion pipeline.

Why Databricks?

Databricks was chosen as the central component of our new architecture due to its powerful capabilities for real-time analytics and data processing. Databricks offers several advantages in this scenario:

  • Scalable Data Processing: Databricks can handle large volumes of streaming data, making it an ideal platform for real-time batch ingestion.
  • Unified Platform: Databricks brings both data engineering and analytics into one environment, reducing the need for multiple resources.
  • Integrated Storage and Transformation: Direct ingestion from Kafka to Databricks allows data to be transformed and stored in a data lake without intermediary steps, reducing latency and complexity.

Technical Deep Dive

With the new setup, we have achieved a simpler, more optimized real-time batch ingestion process. Here’s a technical breakdown of how it works:

  1. Kafka Ingestion: Kafka acts as the streaming data source, providing real-time data directly to Databricks. Databricks’ built-in Kafka connector allows seamless ingestion without the need for Azure Functions as an intermediary.
  2. Data Processing in Databricks: Once ingested, data can undergo various transformations and aggregations within Databricks. This approach allows us to run near-real-time ETL processes in a highly scalable environment.
  3. Direct Storage to Data Lake: Processed data is stored directly in Azure Data Lake, simplifying the data transfer pipeline. This setup enables downstream analytics without the need for additional services such as Event Hub Capture, resulting in lower latency and fewer failure points.

The Business Impact

From a business standpoint, simplifying our architecture has led to significant benefits:

  1. Reduced Operational Costs: By eliminating Azure Functions, Event Hubs, and Event Hub Capture, we reduced resource usage and associated costs. The streamlined architecture also minimizes maintenance costs as fewer components need regular monitoring and management.
  2. Increased Performance: The direct connection between Kafka and Databricks reduces latency and improves the speed of data processing. This enables faster insights and better responsiveness for business intelligence needs.
  3. Enhanced Reliability and Reduced Risk: With fewer points of failure in the architecture, the risk of data loss or service downtime is minimized. Fewer components mean a more robust system overall, allowing us to meet service-level agreements (SLAs) with greater confidence.
  4. Better Resource Allocation: Simplifying the architecture has freed up resources, allowing our team to focus on more strategic, value-adding activities rather than routine maintenance.

Technical and Architectural Benefits

This refined architecture offers numerous technical advantages:

  • Simplified Management: With fewer Azure components, the management and operational overhead have significantly decreased. This makes the architecture more agile and easier to scale.
  • Improved Data Processing Speed: By reducing the number of data hops, we’ve improved processing times, making it possible to achieve near-real-time ingestion and transformation.
  • Scalability and Flexibility: Databricks’ ability to scale with data volumes ensures we can easily adjust for demand without overhauling the entire architecture. Additionally, the flexibility of Databricks allows for easier implementation of future modifications or integrations.

Lessons Learned and Key Takeaways

Transitioning to this simplified architecture taught us several valuable lessons that can apply to similar scenarios:

  • Avoid Over-Architecting: In many cases, the simplest solution is the best solution. By taking a step back and evaluating the core needs, we could design a leaner, more efficient setup.
  • Focus on Direct Integrations: When possible, direct connections between data sources and processing platforms can reduce latency and improve reliability.
  • Regular Architecture Reviews: Our journey highlighted the importance of regular architectural reviews. Data architecture needs evolve, and by periodically reassessing our setup, we can ensure it continues to meet business needs in the most efficient way possible.

Conclusion

By redesigning our real-time batch ingestion architecture, we created a streamlined, efficient, and cost-effective solution that better meets both business and technical needs. Leveraging Kafka and Databricks directly has reduced complexity, increased performance, and improved reliability, all while lowering costs.

As data demands grow, ensuring that your architecture is both effective and manageable becomes crucial. For us, this change has not only improved operational efficiency but also given us a foundation that will scale with our future needs. If you’re dealing with a complex data ingestion setup, it may be time to consider a similar simplification.

Rakesh Gupta
Rakesh Gupta

Written by Rakesh Gupta

Founder and IT Consultant, SketchMyView (www.sketchmyview.com). Reach me here: linkedin.com/in/grakeshk

No responses yet