Spark & PySpark
When NOT to Use Kafka, Spark, or Airflow
The Most Dangerous Engineer Is the One Who Uses the Same Three Tools for Every Problem

TL;DR
- Kafka is a distributed commit log for high-throughput, multi-consumer event streams — not a queue for 500 events a day
- Spark is a distributed compute engine for data that doesn’t fit on one machine — not a pandas replacement with more configuration
- Airflow is a workflow orchestrator for complex DAG dependencies — not a cron job with a UI
- The operational cost of each tool is real, constant, and paid whether or not the problem justifies it
- The boring tool that solves the problem is always better than the impressive tool that over-solves it
Complexity is not sophistication. Sometimes a cron job is the answer.
We inherited a Kafka cluster running in production. Three topics. One producer. One consumer. 200 events per day. Average message size: 340 bytes.
The cluster had three brokers. Replication factor of 3. ZooKeeper ensemble. A dedicated ops rotation for broker health.
We replaced it with a Postgres table and a background job that polled every 30 seconds.
Nobody noticed. The pipeline got faster. The ops rotation disappeared. The monthly infrastructure cost dropped by $800.
Every data engineering team eventually develops a default stack. The stack feels safe — familiar tools, established patterns, known failure modes. And then something happens: the stack becomes the answer before the question is asked.
New pipeline? Kafka. Big data? Spark. Scheduling? Airflow. Even when the data isn’t big, the throughput doesn’t justify a distributed log, and the schedule has no dependencies.
This blog is about the specific conditions under which each of these tools is the wrong choice — and what to reach for instead.
The Overengineering Pattern
It follows a predictable sequence.
A team learns a tool. They use it successfully on a problem it fits. They gain confidence. The next problem arrives. The tool is applied before the constraints are checked. The tool works — technically — but it introduces operational overhead that the problem never justified.
The overhead is real and constant: cluster maintenance, monitoring, on-call rotations, debugging distributed failures, onboarding new engineers to a complex stack. These costs do not scale down when the workload is small. A Kafka cluster that processes 200 events per day costs nearly as much to operate as one that processes 200,000.
The question that breaks the pattern: what is the simplest system that correctly solves this problem?
Not the most scalable. Not the most impressive. The simplest that works correctly.
When NOT to Use Kafka
Kafka is exceptional at what it does: durable, ordered, replayable, high-throughput event streaming with multiple independent consumers. When those properties are required, Kafka is the right choice with essentially no serious competition.
But most problems don’t require all of those properties simultaneously.
The Warning Signs
You probably don’t need Kafka if:
- Your event volume is under 10,000 events per hour and you have one consumer
- You don’t need replay — if an event is processed, it’s gone
- You don’t need ordering guarantees beyond what a timestamp provides
- Your “consumers” are actually just one pipeline that runs on a schedule
- The main reason you’re using it is because the team knows it
The replay and multi-consumer properties are Kafka’s genuine superpowers. If you don’t need either of them, you are paying the full operational cost of Kafka for properties you’re not using.
What to Use Instead
For low-volume, single-consumer event processing:
# Postgres as a queue — genuinely fine for most internal pipelines
# Producer: insert events as rows
INSERT INTO event_queue (event_id, payload, created_at, processed)
VALUES (%s, %s, NOW(), FALSE);
# Consumer: poll and process
SELECT * FROM event_queue
WHERE processed = FALSE
ORDER BY created_at
LIMIT 100
FOR UPDATE SKIP LOCKED;
# Mark processed after successful handling
UPDATE event_queue
SET processed = TRUE, processed_at = NOW()
WHERE event_id = ANY(%s);FOR UPDATE SKIP LOCKED is the critical piece — it prevents two consumers from picking up the same row, which gives you safe concurrent processing without Kafka's complexity.
For slightly higher volume: Redis Streams, SQS, or RabbitMQ. All of these have lower operational cost than Kafka and solve the “durable queue with at-least-once delivery” problem without requiring a cluster.
The One Question
Before reaching for Kafka, answer this: do you have more than one independent consumer that needs to process the same events at different speeds?
If yes — Kafka’s consumer group model earns its keep.
If no — you need a queue, not a distributed log. They are different things.
When NOT to Use Spark
Spark solves one problem extremely well: distributed computation on data that doesn’t fit on a single machine. When your dataset is in the tens or hundreds of gigabytes and beyond, Spark’s ability to parallelize across a cluster is genuinely necessary.
Below that threshold, it is genuinely counterproductive.
The Warning Signs
You probably don’t need Spark if:
- Your dataset fits in memory on a single machine (under ~50 GB)
- Your job runs in under 5 minutes on a single node
- You’re mostly doing SQL aggregations on a data warehouse
- Your “big data” pipeline processes 500 MB files on a daily schedule
- The job has more driver startup overhead than actual computation
Spark has significant fixed overhead: JVM startup, SparkContext initialization, executor provisioning, shuffle coordination. For small datasets, this overhead can exceed the actual computation time. A pandas job that takes 30 seconds runs in 8 minutes on Spark — because most of that 8 minutes is cluster coordination, not data processing.
The team that spent three days debugging a Spark job that was reading a 200 MB CSV file knows this feeling. The fix was switching to pandas. The job went from 12 minutes to 45 seconds. Three days of debugging for a tool that was never the right choice.
What to Use Instead
For datasets under ~50 GB:
# DuckDB — SQL on local files, genuinely fast, zero infrastructure
import duckdb
result = duckdb.sql("""
SELECT
region,
DATE_TRUNC('month', event_date) AS month,
SUM(revenue) AS total_revenue,
COUNT(DISTINCT customer_id) AS unique_customers
FROM read_parquet('s3://bucket/events/*.parquet')
WHERE event_date >= '2026-01-01'
GROUP BY 1, 2
ORDER BY 2, 1
""").df()DuckDB reads directly from S3, processes columnar Parquet efficiently, and executes SQL aggregations at speeds that embarrass Spark on datasets under a few hundred GB — with zero cluster management, zero executor configuration, and zero ZooKeeper.
For datasets between 50 GB and a few TB where you need distribution but not full Spark: consider Dask or Polars with chunked processing before reaching for a cluster.
The DuckDB Moment
The moment that changed how a lot of teams think about this: a data scientist needed to aggregate 18 months of clickstream data for an experiment analysis. The data was ~80 GB of Parquet in S3. The team spun up an EMR cluster, ran a Spark job, waited 40 minutes, and got the answer.
A month later, a different engineer tried the same query in DuckDB on their laptop.
Six minutes. No cluster. No configuration. No cloud bill.
Spark is not faster than DuckDB at 80 GB. It is dramatically slower. Spark’s advantage starts where single-machine memory ends — somewhere around 200–500 GB depending on the machine. Below that, the distribution overhead is pure waste.
When NOT to Use Airflow
Airflow is a DAG-based workflow orchestrator. Its value is managing complex dependency graphs — tasks that depend on other tasks, pipelines that depend on other pipelines, sensors that wait for external conditions before proceeding.
When that complexity is absent, Airflow is an expensive, failure-prone way to run a cron job.
The Warning Signs
You probably don’t need Airflow if:
- You have one pipeline with no upstream dependencies
- Your “DAG” is a straight line: task A → task B → task C
- The pipeline runs on a fixed schedule with no conditional logic
- You spend more time debugging Airflow than debugging the pipeline
- You added Airflow because you thought you’d need it eventually
Airflow has real operational weight: a web server, a scheduler, a metadata database, workers, and a message broker (Celery or Kubernetes). All of these need to be running, monitored, and maintained — for every pipeline, including the ones that are just two SQL queries on a cron.
The scheduler is also a known failure point. Airflow’s scheduler is not simple. It misses tasks. It gets into states that require manual intervention. There are entire Slack channels dedicated to “why did my DAG not trigger at midnight.” For a pipeline that should run at 2 AM every day, this is a significant operational tax.
What to Use Instead
For a single pipeline on a fixed schedule with no complex dependencies:
# cron — genuinely the right answer for simple schedules
# /etc/cron.d/pipeline
0 2 * * * pipeline_user /usr/local/bin/python /opt/pipelines/daily_revenue.py >> /var/log/pipeline.log 2>&1Or GitHub Actions, which gives you a UI, logging, retry configuration, and secrets management — for free, with zero infrastructure:
# .github/workflows/daily-pipeline.yml
name: Daily Revenue Pipeline
on:
schedule:
- cron: '0 2 * * *'
workflow_dispatch: # manual trigger when needed
jobs:
run-pipeline:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Run pipeline
env:
DB_CONNECTION: ${{ secrets.DB_CONNECTION }}
run: python pipelines/daily_revenue.pyFor pipelines that are slightly more complex — a few dependent tasks, some conditional logic — Prefect or Dagster are significantly lighter than Airflow and easier to debug. They’re also designed around the modern cloud-native model where the orchestrator doesn’t need to manage its own worker infrastructure.
When Airflow Actually Earns Its Keep
Airflow is genuinely the right tool when:
- You have dozens of pipelines with complex inter-dependencies
- Tasks depend on the completion of tasks in other DAGs
- You need sensor-based triggering (wait for a file to land, a table to update, an API to return)
- You have a team large enough that a shared orchestration UI adds real coordination value
- You need fine-grained retry policies with exponential backoff per task
At that level of complexity, Airflow’s features — cross-DAG dependencies, sensors, the UI for monitoring — are genuinely useful. Below that level, they are overhead.
The Pattern Underneath All Three
Kafka, Spark, and Airflow are all excellent tools for the problems they were designed to solve.
The problem is not the tools. It is the sequence: tool → problem, instead of problem → tool.
When a team starts with the stack and fits the problem to the stack, the result is always the same: correct output, unjustified complexity, operational debt that grows quietly while the team focuses on the next feature.
The more useful question, before any tool decision, is: what would this pipeline look like if I built it with the simplest possible components?
A Postgres queue table and a background job. A DuckDB query on a laptop. A cron job and a shell script. A GitHub Action that runs at midnight.
If that simpler version fails to meet an actual requirement — throughput, latency, scale, fault tolerance — then the more complex tool is justified by a specific failure mode. Not by general preference. Not by “we’ll probably need it eventually.”
That specific failure mode is the only good reason to add complexity.
🚀 Final Takeaway
The engineers who reach for Kafka, Spark, and Airflow by default are not wrong about the tools. They are wrong about the sequence.
Start with the simplest system that correctly solves the problem. Add complexity when a specific requirement cannot be met by simpler means. Name what the complexity buys you. Be honest about what it costs.
The boring pipeline that runs correctly every night is worth more than the impressive architecture that requires a dedicated ops rotation to keep alive.
📌 Core Principle
The right tool is the one that solves the problem with the least complexity you can justify.
Complexity is not sophistication.
It is a cost — paid in operations, debugging, and the 3 AM calls that come when the impressive architecture breaks.
🔥 Next in Series
🗺️ Choosing the Right Architecture — A Decision Framework
You know when not to use the defaults.
Now: how to choose what to use instead — a structured framework for moving from requirements to architecture without defaulting to what the team already knows.
Batch vs streaming. Lakehouse vs warehouse. Managed vs self-hosted. Orchestrated vs event-driven.
Every decision, grounded in constraints — not preferences.
🔔 Follow for More
Follow TheDataForge for high-signal deep dives on Spark, Kafka, Streaming, Lakehouse, and real-world data engineering — no fluff, only engineering truth.
⚡️Let’s connect — I post daily Big Data & Spark insights at DataForgeX on X.
💬 Comment Below
What’s the most overengineered pipeline you’ve inherited?
A Kafka cluster processing 50 events per hour? A Spark job reading a 200 MB file? An Airflow DAG with one task that runs a single SQL query?
Or have you been the one who added the complexity — and had to defend it six months later when someone asked why the infrastructure cost that much?
👇 Real overengineering stories. No judgment.
🏷️ Tags
#data-engineering #apache-kafka #apache-spark #apache-airflow #system-design #production-engineering #data-architecture #big-data #software-engineering #distributed-systems