Samza
Apache Samza is a distributed stream processing framework originally developed at LinkedIn and contributed to the Apache Software Foundation in 2013, becoming a top-level project on January 22, 2015.
Publisher review
Apache Samza is a distributed stream processing framework originally developed at LinkedIn and contributed to the Apache Software Foundation in 2013, becoming a top-level project on January 22, 2015. It is designed for organizations that need to build stateful, real-time applications processing data from multiple sources, particularly Apache Kafka, with extremely low latencies and high throughput. Samza is best suited for engineers who already run Kafka and want a framework that integrates natively with Kafka's partitioning model, offering guaranteed at-least-once delivery and in-order processing within each partition. It supports flexible deployment on YARN, Kubernetes, or as a standalone library, making it adaptable to various infrastructure preferences. The framework is battle-tested at scale, with adopters including LinkedIn, Uber, TripAdvisor, Slack, eBay, Redfin, and Optimizely, and is used for use cases ranging from real-time analytics to monitoring and alerting.
Samza's architecture is built around a pluggable design that integrates with multiple sources and sinks, including Kafka, HDFS, AWS Kinesis, Azure Event Hubs, key-value stores, and ElasticSearch. It offers a rich set of APIs for building applications: a low-level API for fine-grained control, a Streams DSL for common patterns, Samza SQL for SQL-based stream processing, and support for Apache Beam. A notable capability is the ability to run the same code for both batch and streaming data, simplifying code maintenance. Samza scales horizontally to handle several terabytes of state using incremental checkpoints and host-affinity, which reduces recovery time by keeping state local to the container. In a benchmark published by LinkedIn, Samza processed 1.2 million messages per second on a single node, demonstrating its high-throughput performance. The framework processes messages in the order they appear in each partition, which is critical for keyed data like database update streams.
In the stream processing market, Samza competes directly with Apache Flink, Apache Storm, Kafka Streams, and Kafka Connect. Compared to Storm, Samza offers simpler at-least-once delivery without the overhead of tuple ancestry tracking, and it processes messages in order within a partition, making it better for keyed data. Unlike Flink, which has gained broader community momentum, Samza has seen declining community activity and fewer recent releases. Kafka Streams, being a lightweight library rather than a framework, competes for similar Kafka-centric use cases but with a smaller footprint. Samza's integration with YARN and standalone modes gives it deployment flexibility that Kafka Streams lacks, but its complexity and learning curve are higher. The framework's founder has acknowledged that Samza was proposed for wrong use cases and was "born at the wrong time," reflecting its struggle to maintain relevance against more popular alternatives.
The honest trade-offs with Samza are significant. Community activity has declined, with the latest release (1.8.0) coming in January 2023, and fewer contributions compared to Flink or Kafka Streams. The application code can be complex, especially when using the low-level API, and the framework's design lessons suggest it may have been over-engineered for some use cases. Samza only offers at-least-once delivery currently, with exactly-once semantics planned but not yet implemented, which limits its use for applications requiring strict consistency. Its tight coupling with Kafka, while a strength for Kafka users, makes it less suitable for environments using other message brokers. Additionally, the learning curve is steeper than Kafka Streams, and the documentation, while thorough, can be overwhelming for newcomers. For teams already invested in Kafka and needing high-throughput, stateful stream processing with flexible deployment, Samza remains a viable option, but the declining ecosystem and competition from Flink and Kafka Streams make it a riskier long-term choice.
How it works
-
Low-latency high-throughput processing
Benchmarked at 1.2 million messages per second on a single node, enabling instant data analysis for real-time applications.
-
Horizontal scalability with state management
Scales to several terabytes of state using incremental checkpoints and host-affinity, reducing recovery time by keeping state local.
-
Flexible deployment options
Supports YARN, Kubernetes, or standalone deployment, allowing teams to choose the infrastructure that fits their operations.
-
Rich API choices
Offers low-level API, Streams DSL, Samza SQL, and Apache Beam support, catering to different developer preferences and use cases.
-
Unified batch and streaming code
Same code can process both batch and streaming data, reducing code duplication and simplifying maintenance.
-
Pluggable source and sink integration
Integrates with Kafka, HDFS, AWS Kinesis, Azure Event Hubs, key-value stores, and ElasticSearch for flexible data pipelines.
-
Guaranteed in-order message delivery
Processes messages in the order they appear within each partition, ensuring consistency for keyed data like database updates.
Strengths and trade-offs
Strengths
- Benchmarked at 1.2 million messages per second on a single node, demonstrating industry-leading throughput for stream processing.
- Horizontal scalability supports several terabytes of state with incremental checkpoints and host-affinity for fast recovery.
- Flexible deployment on YARN, Kubernetes, or standalone gives teams control over their infrastructure without vendor lock-in.
- Rich API suite includes low-level, Streams DSL, Samza SQL, and Apache Beam, accommodating diverse developer skill levels and use cases.
Trade-offs
- Declining community activity and fewer recent releases (latest 1.8.0 in January 2023) compared to competitors like Flink and Kafka Streams.
- Only supports at-least-once delivery; exactly-once semantics are planned but not yet implemented, limiting use for strict consistency.
- Application code can be complex, especially with the low-level API, increasing development time and maintenance overhead.
- Tight coupling with Kafka makes it less suitable for environments using other message brokers, reducing flexibility.
Pricing context
Open-source under Apache License 2.0; enterprise support available from third-party vendors but no official pricing tiers from the Apache project.
Getting started with Samza
-
Download and install Samza
Download the latest Samza release from the Apache website or clone the repository. Set up a Java environment (JDK 8 or later) and build Samza using Gradle. Verify the installation by running the provided quickstart example.
-
Connect to Kafka cluster
Configure Samza to connect to your Kafka cluster by specifying the broker list in the job configuration file. Set the input and output topics for your stream processing pipeline, ensuring the topics exist and have appropriate partitions.
-
Define your stream processing logic
Write a Samza job using the Streams DSL or low-level API to process messages. For example, create a simple filter or transformation function that reads from the input topic, processes each message, and writes results to the output topic.
-
Run the Samza job
Package your job into a JAR file and deploy it using Samza's command-line tools. Choose a deployment mode (YARN, Kubernetes, or standalone) and start the job. Monitor the console logs to confirm messages are being processed.
-
Scale and monitor performance
Increase parallelism by adding more containers or partitions to handle higher throughput. Use Samza's built-in metrics (e.g., processing rate, latency) to monitor performance. Adjust checkpoint intervals and state store settings as needed.
Frequently Asked Questions
What is Apache Samza and what is it used for?
Apache Samza is a distributed stream processing framework originally developed at LinkedIn for building stateful, real-time applications. It integrates natively with Apache Kafka, offering low latency and high throughput, and is used for use cases like real-time analytics, monitoring, and alerting.
How does Samza compare to Apache Flink and Kafka Streams?
Samza offers simpler at-least-once delivery than Storm and processes messages in order within partitions. Unlike Flink, it has declining community activity and fewer releases. Kafka Streams is a lighter library for Kafka-centric use cases, while Samza provides more deployment flexibility on YARN or Kubernetes.
What deployment options does Apache Samza support?
Samza supports flexible deployment on YARN, Kubernetes, or as a standalone library. This allows teams to choose infrastructure that fits their operations, making it adaptable to various environments without vendor lock-in.
What are the main strengths of Apache Samza?
Samza is benchmarked at 1.2 million messages per second on a single node, scales to several terabytes of state with incremental checkpoints, and offers flexible deployment. It also provides a rich API suite including low-level, Streams DSL, Samza SQL, and Apache Beam support.
What are the weaknesses and risks of using Samza?
Samza has declining community activity with the latest release in January 2023, only supports at-least-once delivery without exactly-once semantics, and has complex application code. Its tight coupling with Kafka limits use with other brokers, and the learning curve is steeper than Kafka Streams.
Can Samza process both batch and streaming data with the same code?
Yes, Samza allows running the same code for both batch and streaming data. This capability simplifies code maintenance and reduces duplication, making it easier for developers to handle different data processing modes without separate implementations.
Alternatives
How Samza compares
Direct head-to-head against 3 competitors. Picked by 7wData.
Samza
- Pricing
- Open-source under Apache License 2.0; enterprise support available from third-party vendors but no official pricing tiers from the Apache project.
- Target
- Apache Samza is a distributed stream processing framework originally developed at LinkedIn and contributed to the Apache Software Foundation in 2013, becoming a top-level project
- Strength
- Benchmarked at 1.2 million messages per second on a single node, demonstrating industry-leading throughput for stream processing.
- Watch for
- Declining community activity and fewer recent releases (latest 1.8.0 in January 2023) compared to competitors like Flink and Kafka Streams.
Apache Kafka
- Pricing
- Free (Open Source)
- Target
- High-throughput distributed event streaming
- Deployment
- On-prem/Cloud
- Strength
- Scalable pub/sub messaging with durability
- Watch for
- Operational complexity at scale
Apache Flink
- Pricing
- Free (Open Source)
- Target
- Stateful stream processing
- Deployment
- On-prem/Cloud/K8s
- Strength
- Exactly-once processing guarantees
- Watch for
- Steeper learning curve for APIs
Confluent
- Pricing
- $0.10/GB (Cloud Basic)
- Target
- Managed Kafka ecosystems
- Deployment
- Cloud/Hybrid
- Strength
- Enterprise-grade Kafka tooling
- Watch for
- Vendor lock-in with proprietary features
User reviews
No user reviews yet. Be the first to write one.
Sources
Reporting on this tool draws on these publicly available sources.