Use Cases And Challenges of Kafka Log Processing

4 MIN READ
MIN READ

This is a continuation in a series where we share tidbits of our experience in scaling our log management platform. Read last week's article about How to prevent losing log lines when using Elastic Search in production. Organizations that handle logging at scale eventually run into the same problem: too many events are being generated, and logging components can't keep up. Even with persistent queues and other mitigating features enabled, there's simply not enough of a buffer between log generators and log ingesters to handle the volume of log lines coming in. Services become unresponsive, messages are dropped, and valuable data is permanently lost, which is why you end up choosing a messaging system like Apache Kafka.

What is Apache Kafka?

Apache Kafka is an open source message streaming platform commonly used as a log broker. Its popularity stems from its high throughput rate, resiliency, and low resource consumption. Even though Kafka generally works handling production log data, scaling Kafka gets expensive due to its constraints. In this post, we'll explore Kafka's pros and cons, why it's commonly used as a log streaming platform, and why there's a need for a better solution.

Use Cases of Kafka Log Processing

There are plenty of valid reasons why organizations use Kafka to broker log data. Organizations that perform logging at scale need to deliver, parse, and index millions of log messages from hundreds of nodes. Kafka is specifically designed for this kind of distributed, high volume message stream. Using Kafka ensures your logging solution can process each event without being overwhelmed and dropping messages or placing back pressure on log producers. This is made possible through Kafka's publish–subscribe (pub/sub) model. Log producers (publishers) send events to Kafka, which evenly distributes events into partitions. Log consumers (subscribers) are assigned to each partition and pull events on a first in, first out basis. Consumers track their current progress in the partition, which reduces the load on Kafka while allowing consumers to freely move forward or backward through the queue. Replication is built into Kafka. Each partition can have multiple replicas that mirror the main partition as closely as possible. In the event of a failure, Kafka automatically fails over to a replica, adding another layer of safety.

Kafka Challenges

Kafka's key strength is also its greatest weakness: scalability. As the number of publishers and subscribers grows, so does the complexity and overhead of deploying and maintaining a Kafka instance.

Complex Deployments

As with any application running at scale, Kafka requires a significant amount of preparation and customization on the network, hardware, OS, and application level. Kafka's performance and stability depends heavily on RAM capacity, disk throughput, file system tuning, and network latency. Kafka also relies on Apache ZooKeeper, which you will need to deploy separately from Kafka to avoid a single point of failure.While it's possible to deploy Kafka and ZooKeeper over Kubernetes, the process is fairly new and untested in the community. Kafka must be deployed as a StatefulSet in order to preserve the uniqueness of each Pod and storage volume. StatefulSets only reached general availability in Kubernetes 1.9 and introduce additional limitations impacting their scalability and persistence.

Configuration Limitations

Kafka organizes messages into topics, which are further divided into partitions. Each partition is an ordered queue of messages assigned to a specific consumer. In general, more partitions leads to higher throughput at the cost of availability, latency, and memory. However, this limits the number of consumers in any one consumer group to the number of partitions. The only way to add a consumer is by increasing the number of partitions and assigning the new consumer to the partition. Adding a member to a consumer group also triggers an automatic rebalancing of partitions across consumers. This limitation is an operational nightmare, especially in times when there’s a bottleneck with ElasticSearch and you want to add more consumers to process the data and clear the queue and don’t want to incur the expensive cost of additional resources and the performance hit of rebalancing the partitions.This hard limitation of having to scale up the number of partitions to increase the number of consumers is an expensive proposition that doesn't scale with the log volumes that LogDNA faces on a daily basis. This prompted us to design our own solution that primarily allows us to spin up as many consumers as needed.

Data Integrity

Kafka aims to deliver each message only once, but this is easier said than done. As we mentioned earlier, the consumers are the ones responsible for tracking their progress through a partition. Consumers request the next available message based on their last successfully processed message, and in the event of a delivery error, a consumer can simply re-download the failed message before moving on to the next one. The problem is that Kafka only caches messages for a certain amount of time, or until it consumes a certain amount of disk space. If either of these limits is reached before a consumer pulls the next message, then the message will be deleted. Alternatively, if the consumer pulls a message but fails to update its tracking state, it will download duplicate messages. This might not be an issue for smaller deployments, but consider a deployment handling ten thousand messages per second. If only 1% of those messages are duplicates, that's still 8.64 million duplicate messages being parsed, indexed, alerted on, and stored daily.

Ongoing Maintenance

Maintaining a large Kafka deployment requires constant monitoring and maintenance. Even the most stable and fault tolerant Kafka deployments are susceptible to sudden unexpected failures. In one event called the "Kafkapocalypse," the team at New Relic found that their entire Kafka cluster had gone down after over a year of steady performance.In a more recent incident, consumers were processing data far slower than producers were sending data, leading to 8-minute delays between events being created and events being processed. Resolving both situations involved creating detailed retention policies, carefully balancing throughput and replication, and using multiple tiers of alerts and escalations.

Avoid Kafka Logging At Scale

Although Kafka appears to provide a capable log brokering solution, running it at scale introduces a host of performance and stability problems. In order to process millions of log lines per second and 20TB+ day of log volume for our customers, the engineering team at LogDNA faced every imaginable production issue with Elasticsearch. In order to support the exponential growth in customer log volume, we realized we'd have to come up with our own innovative solutions. After running into limitations with scaling Kafka, we wrote our own persistent message broker that allows us to scale up to an infinite number of consumers and process millions of log messages per second in more efficient and resourceful ways. If you are growing out of your ELK instance and hitting limits with Kafka, sign up for a 14-day free trial at LogDNA.

Table of Contents

    Share Article

    RSS Feed

    Next blog post
    You're viewing our latest blog post.
    Previous blog post
    You're viewing our oldest blog post.
    Mezmo + Catchpoint deliver observability SREs can rely on
    Mezmo’s AI-powered Site Reliability Engineering (SRE) agent for Root Cause Analysis (RCA)
    What is Active Telemetry
    Launching an agentic SRE for root cause analysis
    Paving the way for a new era: Mezmo's Active Telemetry
    The Answer to SRE Agent Failures: Context Engineering
    Empowering an MCP server with a telemetry pipeline
    The Debugging Bottleneck: A Manual Log-Sifting Expedition
    The Smartest Member of Your Developer Ecosystem: Introducing the Mezmo MCP Server
    Your New AI Assistant for a Smarter Workflow
    The Observability Problem Isn't Data Volume Anymore—It's Context
    Beyond the Pipeline: Data Isn't Oil, It's Power.
    The Platform Engineer's Playbook: Mastering OpenTelemetry & Compliance with Mezmo and Dynatrace
    From Alert to Answer in Seconds: Accelerating Incident Response in Dynatrace
    Taming Your Dynatrace Bill: How to Cut Observability Costs, Not Visibility
    Architecting for Value: A Playbook for Sustainable Observability
    How to Cut Observability Costs with Synthetic Monitoring and Responsive Pipelines
    Unlock Deeper Insights: Introducing GitLab Event Integration with Mezmo
    Introducing the New Mezmo Product Homepage
    The Inconvenient Truth About AI Ethics in Observability
    Observability's Moneyball Moment: How AI Is Changing the Game (Not Ending It)
    Do you Grok It?
    Top Five Reasons Telemetry Pipelines Should Be on Every Engineer’s Radar
    Is It a Cup or a Pot? Helping You Pinpoint the Problem—and Sleep Through the Night
    Smarter Telemetry Pipelines: The Key to Cutting Datadog Costs and Observability Chaos
    Why Datadog Falls Short for Log Management and What to Do Instead
    Telemetry for Modern Apps: Reducing MTTR with Smarter Signals
    Transforming Observability: Simpler, Smarter, and More Affordable Data Control
    Datadog: The Good, The Bad, The Costly
    Mezmo Recognized with 25 G2 Awards for Spring 2025
    Reducing Telemetry Toil with Rapid Pipelining
    Cut Costs, Not Insights:   A Practical Guide to Telemetry Data Optimization
    Webinar Recap: Telemetry Pipeline 101
    Petabyte Scale, Gigabyte Costs: Mezmo’s Evolution from ElasticSearch to Quickwit
    2024 Recap - Highlights of Mezmo’s product enhancements
    My Favorite Observability and DevOps Articles of 2024
    AWS re:Invent ‘24: Generative AI Observability, Platform Engineering, and 99.9995% Availability
    From Gartner IOCS 2024 Conference: AI, Observability Data, and Telemetry Pipelines
    Our team’s learnings from Kubecon: Use Exemplars, Configuring OTel, and OTTL cookbook
    How Mezmo Uses a Telemetry Pipeline to Handle Metrics, Part II
    Webinar Recap: 2024 DORA Report: Accelerate State of DevOps
    Kubecon ‘24 recap: Patent Trolls, OTel Lessons at Scale, and Principle Platform Abstractions
    Announcing Mezmo Flow: Build a Telemetry Pipeline in 15 minutes
    Key Takeaways from the 2024 DORA Report
    Webinar Recap | Telemetry Data Management: Tales from the Trenches
    What are SLOs/SLIs/SLAs?
    Webinar Recap | Next Gen Log Management: Maximize Log Value with Telemetry Pipelines
    Creating In-Stream Alerts for Telemetry Data
    Creating Re-Usable Components for Telemetry Pipelines
    Optimizing Data for Service Management Objective Monitoring
    More Value From Your Logs: Next Generation Log Management from Mezmo
    A Day in the Life of a Mezmo SRE
    Webinar Recap: Applying a Data Engineering Approach to Telemetry Data
    Dogfooding at Mezmo: How we used telemetry pipeline to reduce data volume
    Unlocking Business Insights with Telemetry Pipelines
    Why Your Telemetry (Observability) Pipelines Need to be Responsive
    How Data Profiling Can Reduce Burnout
    Data Optimization Technique: Route Data to Specialized Processing Chains
    Data Privacy Takeaways from Gartner Security & Risk Summit
    Mastering Telemetry Pipelines: Driving Compliance and Data Optimization
    A Recap of Gartner Security and Risk Summit: GenAI, Augmented Cybersecurity, Burnout
    Why Telemetry Pipelines Should Be A Part Of Your Compliance Strategy
    Pipeline Module: Event to Metric
    Telemetry Data Compliance Module
    OpenTelemetry: The Key To Unified Telemetry Data
    Data optimization technique: convert events to metrics
    What’s New With Mezmo: In-stream Alerting
    How Mezmo Used Telemetry Pipeline to Handle Metrics
    Webinar Recap: Mastering Telemetry Pipelines - A DevOps Lifecycle Approach to Data Management
    Open-source Telemetry Pipelines: An Overview
    SRECon Recap: Product Reliability, Burn Out, and more
    Webinar Recap: How to Manage Telemetry Data with Confidence
    Webinar Recap: Myths and Realities in Telemetry Data Handling
    Using Vector to Build a Telemetry Pipeline Solution
    Managing Telemetry Data Overflow in Kubernetes with Resource Quotas and Limits
    How To Optimize Telemetry Pipelines For Better Observability and Security
    Gartner IOCS Conference Recap: Monitoring and Observing Environments with Telemetry Pipelines
    AWS re:Invent 2023 highlights: Observability at Stripe, Capital One, and McDonald’s
    Webinar Recap: Best Practices for Observability Pipelines
    Introducing Responsive Pipelines from Mezmo
    My First KubeCon - Tales of the K8’s community, DE&I, sustainability, and OTel
    Modernize Telemetry Pipeline Management with Mezmo Pipeline as Code
    How To Profile and Optimize Telemetry Data: A Deep Dive
    Kubernetes Telemetry Data Optimization in Five Steps with Mezmo
    Introducing Mezmo Edge: A Secure Approach To Telemetry Data
    Understand Kubernetes Telemetry Data Immediately With Mezmo’s Welcome Pipeline
    Unearthing Gold: Deriving Metrics from Logs with Mezmo Telemetry Pipeline
    Webinar Recap: The Single Pane of Glass Myth
    Empower Observability Engineers: Enhance Engineering With Mezmo
    Webinar Recap: How to Get More Out of Your Log Data
    Unraveling the Log Data Explosion: New Market Research Shows Trends and Challenges
    Webinar Recap: Unlocking the Full Value of Telemetry Data
    Data-Driven Decision Making: Leveraging Metrics and Logs-to-Metrics Processors
    How To Configure The Mezmo Telemetry Pipeline
    Supercharge Elasticsearch Observability With Telemetry Pipelines
    Enhancing Grafana Observability With Telemetry Pipelines
    Optimizing Your Splunk Experience with Telemetry Pipelines
    Webinar Recap: Unlocking Business Performance with Telemetry Data
    Enhancing Datadog Observability with Telemetry Pipelines
    Transforming Your Data With Telemetry Pipelines