Conditions Apply

Search

Apache Spark Vs Apache Storm - Head To Head Comparison

In today’s world, the need for real-time data streaming is growing exponentially due to the increase in real-time data. With streaming technologies leading the world of Big Data, it might be tough for the users to choose the appropriate real-time streaming platform. Two of the most popular real-time technologies that might consider for opting are Apache Spark and Apache Storm. One major key difference between the frameworks Spark and Storm is that Spark performs Data-Parallel computations, whereas Storm occupies Task-Parallel computations. Read along to know more differences between Apache Spark and Apache Storm, and understand which one is better to adopt on the basis of different features. Comparison Table: Apache Spark Vs. Apache StormSr. NoParameterApache SparkApache Storm1.Processing  ModelBatch ProcessingMicro-batch processing2.Programming LanguageSupports lesser languages like Java, Scala.Support smultiple languages, such as Scala, Java, Clojure.3.Stream SourcesHDFSSpout4.MessagingAkka, NettyZeroMQ, Netty5.Resource ManagementYarn and Meson are responsible.Yarn and Mesos are responsible.6.Low LatencyHigher latency as compared to SparkBetter latency with lesser constraints7.Stream PrimitivesDStreamTuple, Partition8.Development CostSame code can be used for batch and stream processing.Same code cannot be used for batch and stream processing.9.State ManagementSupports State ManagementSupports State Management as well10.Message Delivery GuaranteesSupports one message processing mode: ‘at least once’.Supports three message processing mode: ‘at least once’, ‘at most once’, ‘exactly once’.11.Fault ToleranceIf a process fails, Spark restarts workers via resource managers. (YARN, Mesos)If a process fails, the supervisor process starts automatically.12.Throughput100k records per node per second10k records per node per second13.PersistenceMapStatePer RDD14.ProvisioningBasic monitoring using GangliaApache AmbariApache Spark: Apache Spark is a general-purpose, lighting fast, cluster-computing technology framework, used for fast computation on large-scale data processing. It can manage both batch and real-time analytics and data processing workloads.  Spark was developed at UC Berkeley in the year 2009. Apache Storm:Apache Storm is an open-source, scalable fault-tolerant, and real-time stream processing computation system. It is a framework for real-time distributed data processing, which focuses on stream processing or event processing. It can be used with any programming language and can be integrated using any queuing or database technology.  Apache Storm was developed by a team led by Nathan Marz at BackType Labs. Apache Spark Vs. Apache Storm1. Processing Model: Apache Storm supports micro-batch processing, while Apache Spark supports batch processing. 2. Programming Language:Storm applications can be created using multiple languages like Java, Scala and Clojure, while Spark applications can be created using Java and Scala.3. Stream Sources:For Storm, the source of stream processing is Spout, while that for Spark is HDFS. 4. Messaging:Storm uses ZeroMQ and Netty as its messaging layer while Spark is using a combination of Nettu and Akka for distributing the messages throughout the executors. 5. Resource Management:Yarn and Meson are responsible for resource management in Spark, while Yarn and Mesos are responsible for resource management in Storm. 6. Low Latency: Spark provides higher latency as compared to Apache Storm, whereas Storm can provide better latency with fewer restrictions.7. Stream Primitives:Spark provides with stream transforming operators which transform DStream into another, while Storm provides with various primitives which perform tuple level of processing at the stream level (functions, filters). 8. Development Cost:It is possible for Spark to use the same code base for both stream processing and batch processing. Whereas for Storm, the same code base cannot be used for both stream processing and batch processing.  9. State Management: The changing and maintaining state in Apache Spark can be updated via UpdateStateByKey, but no pluggable strategy can be applied in the external system for the implementation of state. Whereas Storm does not provide any framework for the storage of any intervening bolt output as a state. Hence, each application has to create a state for itself whenever required. 10. Message Delivery Guarantees (Handling the message level failures):Apache Spark supports only one message processing mode, viz, ‘at least once’, whereas Storm supports three message processing modes, viz, ‘at least once’ (Tuples are processed at least one time, but can be processed more than once), ‘at most once’  and ‘exactly once’ (T^uples are processed at least once). Storm’s reliability mechanisms are scalable, distributed and fault-tolerant. 11. Fault-Tolerant:Apache Spark and Apache Storm, both are fault tolerant to nearly the same extent. If a process fails in Apache Storm, then the supervisor process will restart it automatically, as the state management is managed by Zookeeper, while Spark restarts its workers with the help of resource managers, who may be Mesos, YARN or its separate manager.12. Ease of Development: In the case of Storm, there are effective and easy to use APIs which show that the nature of topology is DAG. The Storm tuples are written dynamically. In the case of Spark, it consists of Java and Scala APIs with practical programming, making topology code a bit difficult to understand. But since the API documentation and samples are easily available for the developers, it is now easier. Summing Up: Apache Spark Vs Apache StormApache Storm and Apache Spark both offer great solutions to solve the transformation problems and streaming ingestions. Moreover, both can be a part of a Hadoop cluster to process data. While Storm acts as a solution for real-time stream processing, developers might find it to be quite complex to develop applications due to its limited resources. The industry is always on a lookout for a generalized solution, which has the ability to solve all types of problems, such as Batch processing, interactive processing, iterative processing and stream processing. Keeping all these points in mind, this is where Apache Spark steals the limelight as it is mostly considered as a general-purpose computation engine, making it a highly demanding tool by IT professionals. It can handle various types of problems and provides a flexible environment to in. Moreover, developers find it to be easy and are able to integrate it well with Hadoop. 
Rated 4.5/5 based on 2 customer reviews

Apache Spark Vs Apache Storm - Head To Head Comparison

27K
Apache Spark Vs Apache Storm - Head To Head Comparison

In today’s world, the need for real-time data streaming is growing exponentially due to the increase in real-time data. With streaming technologies leading the world of Big Data, it might be tough for the users to choose the appropriate real-time streaming platform. Two of the most popular real-time technologies that might consider for opting are Apache Spark and Apache Storm. 

One major key difference between the frameworks Spark and Storm is that Spark performs Data-Parallel computations, whereas Storm occupies Task-Parallel computations. Read along to know more differences between Apache Spark and Apache Storm, and understand which one is better to adopt on the basis of different features. 

Comparison Table: Apache Spark Vs. Apache Storm

Sr. NoParameterApache SparkApache Storm
1.Processing  ModelBatch ProcessingMicro-batch processing
2.Programming LanguageSupports lesser languages like Java, Scala.Support smultiple languages, such as Scala, Java, Clojure.
3.Stream SourcesHDFSSpout
4.MessagingAkka, NettyZeroMQ, Netty
5.Resource ManagementYarn and Meson are responsible.Yarn and Mesos are responsible.
6.Low LatencyHigher latency as compared to SparkBetter latency with lesser constraints
7.Stream PrimitivesDStreamTuple, Partition
8.Development CostSame code can be used for batch and stream processing.Same code cannot be used for batch and stream processing.
9.State ManagementSupports State ManagementSupports State Management as well
10.Message Delivery GuaranteesSupports one message processing mode: ‘at least once’.Supports three message processing mode: ‘at least once’, ‘at most once’, ‘exactly once’.
11.Fault ToleranceIf a process fails, Spark restarts workers via resource managers. (YARN, Mesos)If a process fails, the supervisor process starts automatically.
12.Throughput100k records per node per second10k records per node per second
13.PersistenceMapStatePer RDD
14.ProvisioningBasic monitoring using GangliaApache Ambari

Apache Spark: 

Apache Spark is a general-purpose, lighting fast, cluster-computing technology framework, used for fast computation on large-scale data processing. It can manage both batch and real-time analytics and data processing workloads.  Spark was developed at UC Berkeley in the year 2009. 

Apache Storm:

Apache Storm is an open-source, scalable fault-tolerant, and real-time stream processing computation system. It is a framework for real-time distributed data processing, which focuses on stream processing or event processing. It can be used with any programming language and can be integrated using any queuing or database technology.  Apache Storm was developed by a team led by Nathan Marz at BackType Labs. 

Apache Spark Vs. Apache Storm

1. Processing Model: 

Apache Storm supports micro-batch processing, while Apache Spark supports batch processing. 

2. Programming Language:

Storm applications can be created using multiple languages like Java, Scala and Clojure, while Spark applications can be created using Java and Scala.

3. Stream Sources:

For Storm, the source of stream processing is Spout, while that for Spark is HDFS. 

4. Messaging:

Storm uses ZeroMQ and Netty as its messaging layer while Spark is using a combination of Nettu and Akka for distributing the messages throughout the executors. 

5. Resource Management:

Yarn and Meson are responsible for resource management in Spark, while Yarn and Mesos are responsible for resource management in Storm. 

6. Low Latency: 

Spark provides higher latency as compared to Apache Storm, whereas Storm can provide better latency with fewer restrictions.

7. Stream Primitives:

Spark provides with stream transforming operators which transform DStream into another, while Storm provides with various primitives which perform tuple level of processing at the stream level (functions, filters). 

8. Development Cost:

It is possible for Spark to use the same code base for both stream processing and batch processing. Whereas for Storm, the same code base cannot be used for both stream processing and batch processing.  

9. State Management: 

The changing and maintaining state in Apache Spark can be updated via UpdateStateByKey, but no pluggable strategy can be applied in the external system for the implementation of state. Whereas Storm does not provide any framework for the storage of any intervening bolt output as a state. Hence, each application has to create a state for itself whenever required. 

10. Message Delivery Guarantees (Handling the message level failures):

Apache Spark supports only one message processing mode, viz, ‘at least once’, whereas Storm supports three message processing modes, viz, ‘at least once’ (Tuples are processed at least one time, but can be processed more than once), ‘at most once’  and ‘exactly once’ (T^uples are processed at least once). Storm’s reliability mechanisms are scalable, distributed and fault-tolerant. 

11. Fault-Tolerant:

Apache Spark and Apache Storm, both are fault tolerant to nearly the same extent. If a process fails in Apache Storm, then the supervisor process will restart it automatically, as the state management is managed by Zookeeper, while Spark restarts its workers with the help of resource managers, who may be Mesos, YARN or its separate manager.

12. Ease of Development: 

In the case of Storm, there are effective and easy to use APIs which show that the nature of topology is DAG. The Storm tuples are written dynamically. In the case of Spark, it consists of Java and Scala APIs with practical programming, making topology code a bit difficult to understand. But since the API documentation and samples are easily available for the developers, it is now easier. 

Apache Spark and Apache Storm Features

Summing Up: Apache Spark Vs Apache Storm

Apache Storm and Apache Spark both offer great solutions to solve the transformation problems and streaming ingestions. Moreover, both can be a part of a Hadoop cluster to process data. While Storm acts as a solution for real-time stream processing, developers might find it to be quite complex to develop applications due to its limited resources. 

The industry is always on a lookout for a generalized solution, which has the ability to solve all types of problems, such as Batch processing, interactive processing, iterative processing and stream processing. Keeping all these points in mind, this is where Apache Spark steals the limelight as it is mostly considered as a general-purpose computation engine, making it a highly demanding tool by IT professionals. It can handle various types of problems and provides a flexible environment to in. Moreover, developers find it to be easy and are able to integrate it well with Hadoop. 

KnowledgeHut

KnowledgeHut

Author

KnowledgeHut is a fast growing Management Consulting and Training firm that is a source of Intelligent Information support for businesses and professionals across the globe.


Website : https://www.knowledgehut.com

Join the Discussion

Your email address will not be published. Required fields are marked *

2 comments

priyanka 05 Aug 2019

The comparison between the apache spark Vs. apache storm is very clear loved it thanks for the article...

Vihaan 16 Aug 2019

This is one of the best article I have ever seen. Crystal clear. Thanks for this post.

Suggested Blogs

Best ways to learn Apache Spark

If you ask any industry expert what language should you learn for Big Data? You will get an obvious reply to learn Apache Spark. Apache Spark is widely considered as the future of the Big Data industry. Since Apache Spark has stepped into Big data market, it has gained a lot of recognition for itself. Today, most of the cutting-edge companies like Apple, Facebook, Netflix, and Uber, etc. have deployed Spark at massive scale. In this blog post, we will understand why one should learn Apache Spark? And several ways to learn it. Apache Spark is a powerful open-source framework for the processing of large datasets. It is the most successful projects in the Apache software foundation. Apache Spark basically designed for fast computation, also which runs faster than Hadoop. Apache Spark can collectively process huge amount of data present in clusters over multiple nodes. The main feature of Apache Spark is its in-memory cluster computing that increases the processing speed of an application.Why You Should Learn Apache SparkApache Spark has become the most popular unified analytics engine for Big Data and Machine Learning. Enterprises are widely utilizing Spark which in turn is increasing demand for Apache Spark developers. Apache Spark developers are the ones earning the highest salary. IT professionals can leverage this upcoming skill set gap by pursuing a certification in Apache Spark. A developer with expertise in Apache Spark skills can earn an average salary of $78K as per Payscale. It is the right time for you to learn Apache Spark as there is a very high demand for Spark developers chances of getting a job is high.Here are the reasons why you should learn Apache Spark today:In order to go with the growing demand for Apache SparkTo fulfill the demands for Spark developersTo get benefits of existing big data investmentsResources to learn ReactTo learn Spark, you can refer to Spark’s website. There are multiple resources you will find to learn Apache Spark, from books, blogs, online videos, courses, tutorials, etc. With these multiple resources available today, you might be in the dilemma of choosing the best resource, especially in this fast-paced and swiftly evolving industry.BooksCertificationsVideosTutorials, Blogs, and TalksHands-on Exercises 1. BooksWhen was the last time you read a book? Do you have reading habits? If not, it’s the time to read the books. Reading has a significant number of benefits. Those aren’t fans of books might miss out the importance of Apache Spark. To learn Apache Spark, you can skim through the best Apache Spark books given below.Apache Spark in 24 hours is a perfect book for beginners which comprises 592 pages covering various topics. An excellent book to learn in a very short span of time. Apart from this, there are also books which will help you master.Here is the list of top books to learn Apache Spark:Learning Spark by Matei Zaharia, Patrick Wendell, Andy Konwinski, Holden KarauAdvanced Analytics with Spark by Sandy Ryza, Uri Laserson, Sean Owen and Josh WillsMastering Apache Spark by Mike FramptonSpark: The Definitive Guide – Big Data Processing Made SimpleSpark GraphX in ActionBig Data Analytics with SparkThese are the various Apache Spark books meant for you to learn. These books include for beginners and others for the advanced level professionals.2. Apache Spark Training and CertificationsOne more way to learn Apache Spark is through taking up training. Apache Spark Training will boost your knowledge and also help you learn from experience. You will be certified once you are done with training. Getting this certification will help you stand out of the crowd. You will also gain hands-on skills and knowledge in developing Spark applications through industry-based real-time projects.3. Videos:Videos are really good resources to help you learn Apache Spark. Following are the few videos will help you understand Apache Spark.Overview of SparkIntro to Spark - Brian ClapperAdvanced Spark Analytics - Sameer FarooquiSpark Summit VideosVideos from Spark Summit 2014, San Francisco, June 30 - July 2, 2013Full agenda with links to all videos and slidesTraining videos and slidesVideos from Spark Summit 2013, San Francisco, Dec 2-3-2013Full agenda with links to all videos and slidesYouTube playist of all KeynotesYouTube playist of Track A (Spark Applications)YouTube playist of Track B (Spark Deployment, Scheduling & Perf, Related projects)YouTube playist of the Training Day (i.e. the 2nd day of the summit)You can learn more on Apache Spark YouTube Channel for videos from Spark events. 4. Tutorials, Blogs, and TalksUsing Parquet and Scrooge with Spark — Scala-friendly Parquet and Avro usage tutorial from Ooyala's Evan ChanUsing Spark with MongoDB — by Sampo Niskanen from WellmoSpark Summit 2013 — contained 30 talks about Spark use cases, available as slides and videosA Powerful Big Data Trio: Spark, Parquet and Avro — Using Parquet in Spark by Matt MassieReal-time Analytics with Cassandra, Spark, and Shark — Presentation by Evan Chan from Ooyala at 2013 Cassandra SummitRun Spark and Shark on Amazon Elastic MapReduce — Article by Amazon Elastic MapReduce team member Parviz DeyhimSpark, an alternative for fast data analytics — IBM Developer Works article by M. Tim Jones 5. Hands-on ExercisesHands-on exercises from Spark Summit 2014 - These exercises will guide you to install Spark on your laptop and learn basic concepts.Hands-on exercises from Spark Summit 2013 - These exercises will help you launch a small EC2 cluster, load a dataset, and query it with Spark, Spark Streaming, and MLlib.So these were the best resources to learn Apache Spark. Hope you found what you were looking for. Wish you a Happy Learning!
Rated 4.5/5 based on 1 customer reviews
8854
Best ways to learn Apache Spark

If you ask any industry expert what language shoul... Read More

How Big is ‘Big Data’, Anyway?

When I got introduced to the data-world with my first corporate induction training, about 10 years ago. I was then still processing the difference between Data and Information. The following helped me understand the same:Data: It is raw information (unprocessed facts and figures) without any context for e.g. Number 20Information: structured Data grouped together which can have interpretation. E.g $20 for a toy.Knowledge: combination of information, experience and insight that may benefit the individual for the organisation. E.g. $20 for a toy in Black Friday Sale in a mall.Wisdom: Knowledge becomes wisdom when one can assimilate and apply this knowledge to make the right decisions. E.g. One who wants to buy a toy will wait for the Black Friday Sale to get it at a cheaper price.By the time I started understanding above differences, ‘Big data’ term was already making it big and then the obvious question in mind was,” When to call ‘data’ à ‘ Big data’? “I then made an attempt to understand ‘how big is a data to be called big data?’ and here, I have a big revelation to make, for all of you reading this article, that ‘Big Data’ is actually misleading term and it is irrelevant with “Bigness of data” but it is to be used in relevance. In fact, it is a term which needs to be understood, only in perspective.The simplest one I could find relevant is, Big data is the data that cannot be stored with traditional storages, cannot be processed with traditional methods/ways and within a short period of time (and these references would still be valid as time advances.) but this is not textbook or only definition of big data. Interestingly, One who finds one set of data as big data can be traditional data for others so truly it cannot be bounded in words but loosely can be described through numerous examples. I am sure by the end of the article you will be able to answer the question for yourself. Let’s start.Do you know? - NASA researchers Michael Cox and David Ellsworth use the term “big data” for the first time to describe a familiar challenge in the 1990s supercomputers generating massive amounts of information - in Cox and Ellsworth’s case, simulations of airflow around aircraft - that cannot be processed and visualized.If you go through a brief history of big data, you would know data which is not fitting into memory or disk was called ‘Big data problem’ back in 1997.As the years passed by innovations were on rising and disruptions were made so the data universe is growing all the time. Let’s understand a few widely available and stated statistics for ‘big data’ (Collected around 2017 or before) >>On average, people send about 500 million tweets per day.Snapchat users share 527,760 photos in a minute Instagram users post 46,740 photos in a minute More than 120 professionals join LinkedIn in a minute Users watch 4,146,600 YouTube videos in a minuteThe average U.S. customer uses 1.8 gigabytes of data per month on his or her cell phone plan.Amazon sells 600 items per second.On average, each person who uses email receives 88 emails per day and send 34. That adds up to more than 200 billion emails each day.MasterCard processes 74 billion transactions per year.Commercial airlines make about 5,800 flights per day.You might be interested to read through Domo’s Data Never Sleeps 5.0 report, for the numbers generated every minute of the day.Understanding that the above stats are probably about 1.5-2 years older and data is ever-growing, it helps to establish the fact that ‘big data‘ is a moving target and…. In short,“Today’s big data is tomorrow’s small data.”Now that we have some knowledge about transactions/tweets/snaps in a day, Let’s also understand how much data, all these “One-minute Quickies” are generating. Let’s talk about some volumes too. Afterall volumes are one of the characteristics of big data but mind you, not only characteristic of big data. It is believed that, In a single day, the world produces 2.5 quintillion bytes (2.3 trillion gigabytes) of data, in layman's terms, this is the equivalent of everyone in the world downloading 60 episodes of Breaking Bad, in HD, 20 times! [Source: VCloud 2012] and According to estimates, the volume of data worldwide doubles every 1.2 years.IDC predicts that the collective sum of the world's data will grow from 33 zettabytes this year to a 175ZB by 2025, for a compounded annual growth rate of 61 per cent. The 175ZB figure represents a 9 per cent increase over last year's prediction of data growth by 2025 – As per the report published in Dec’2018.But, do you know: how much would be 1 zettabyte of data? Let’s understand. One zettabyte is equal to one sextillion bytes or 1021 (1,000,000,000,000,000,000,000) bytes or, one zettabyte is roughly equal to a trillion gigabytes.Fun Fact: There is a legit term coined as The Zettabyte Era (Today’s Era).The Zettabyte Era can also be understood as an age of growth of all forms of digital data that exist in the world which includes the public Internet, but also all other forms of digital data such as stored data from security cameras or voice data from cell-phone calls.You must check out this infographic by economywatch (taken from SearchEngineJournal) to understand how much data zettabyte consists of, putting it into context with current data storage capabilities and usage.Today’s ‘big data’ is generated from majority 3 sources i.e.People Generated: Social media uploads, Mails etc. Machine Generated: M2M (machine to machine) interactions, IOT devices etc. Business Generated: Data generated and stored into today’s OLTPs, OLAPs, Data warehouses, data marts, reports, operational data throughout the enterprise/organization.Various analytics tools available in the market today, help in solving big data challenges by providing ways for storing this data, process this data and make valuable insights from this data.As we discussed, big data is moving target as time advances, it is also interesting to know even today, data which is not of huge size but is difficult to process and of relatively smaller volume would still be categorized as Big Data. For example, unstructured data in emails, from social media platforms, data which is required to process with real-time/near real-time etc. all the examples we have seen so far, all of it is big data.   But, It would be a mistake to assume that, Big Data only as data that is analyzed using Hadoop, Spark or another complex analytics platform. As big data is moving the target and it’s ever-growing, also with various disruptive sources of data are being introduced every day, to process this data newer tools would be invented, and hence big data cannot just remain a function of tools being used to analyze it. To conclude, as discussed at the starting of the article, it would still be appropriate and reasonable to say, this moving target of big data which would always be challenged for storage, processing methods and process it within a short period as well. So big data is a function of volume and/or time and/or storage and/or variety. It was fun and exciting to know what different aspects are hidden in ‘BIG DATA’ word and I thoroughly enjoyed solving this mystery.Did you enjoy solving it too?Do let us know how was experience through comments below.Happy Learning!!!
Rated 4.5/5 based on 23 customer reviews
14102
How Big is ‘Big Data’, Anyway?

When I got introduced to the data-world with my fi... Read More

Apache Kafka Vs Apache Spark: Know the Differences

A new breed of ‘Fast Data’ architectures has evolved to be stream-oriented, where data is processed as it arrives, providing businesses with a competitive advantage. - Dean Wampler (Renowned author of many big data technology-related books)Dean Wampler makes an important point in one of his webinars. The demand for stream processing is increasing every day in today’s era. The main reason behind it is, processing only volumes of data is not sufficient but processing data at faster rates and making insights out of it in real time is very essential so that organization can react to changing business conditions in real time.And hence, there is a need to understand the concept “stream processing “and technology behind it. So, what is Stream Processing?Think of streaming as an unbounded, continuous real-time flow of records and processing these records in similar timeframe is stream processing. AWS (Amazon Web Services) defines “Streaming Data” is data that is generated continuously by thousands of data sources, which typically send in the data records simultaneously, and in small sizes (order of Kilobytes). This data needs to be processed sequentially and incrementally on a record-by-record basis or over sliding time windows and used for a wide variety of analytics including correlations, aggregations, filtering, and sampling.In stream processing method, continuous computation happens as the data flows through the system.Stream processing is highly beneficial if the events you wish to track are happening frequently and close together in time. It is also best to utilize if the event needs to be detected right away and responded to quickly.There is a subtle difference between stream processing, real-time processing (Rear real-time) and complex event processing (CEP). Let’s quickly look at the examples to understand the difference. Stream Processing: Stream processing is useful for tasks like fraud detection and cybersecurity. If transaction data is stream-processed, fraudulent transactions can be identified and stopped before they are even complete.Real-time Processing: If event time is very relevant and latencies in the second's range are completely unacceptable then it’s called Real-time (Rear real-time) processing. For ex. flight control system for space programsComplex Event Processing (CEP): CEP utilizes event-by-event processing and aggregation (for example, on potentially out-of-order events from a variety of sources, often with large numbers of rules or business logic).We have multiple tools available to accomplish above-mentioned Stream, Realtime or Complex event Processing. Spark Streaming, Kafka Stream, Flink, Storm, Akka, Structured streaming are to name a few. We will try to understand Spark streaming and Kafka stream in depth further in this article. As historically, these are occupying significant market share. Apache Kafka Stream: Kafka is actually a message broker with a really good performance so that all your data can flow through it before being redistributed to applications. Kafka works as a data pipeline.Typically, Kafka Stream supports per-second stream processing with millisecond latency.  Kafka Streams is a client library for processing and analyzing data stored in Kafka. Kafka streams can process data in 2 ways. Kafka -> Kafka: When Kafka Streams performs aggregations, filtering etc. and writes back the data to Kafka, it achieves amazing scalability, high availability, high throughput etc.  if configured correctly. It also does not do mini batching, which is “real streaming”.Kafka -> External Systems (‘Kafka -> Database’ or ‘Kafka -> Data science model’): Typically, any streaming library (Spark, Flink, NiFi etc) uses Kafka for a message broker. It would read the messages from Kafka and then break it into mini time windows to process it further. Representative view of Kafka streaming: Note:Sources here could be event logs, webpage events etc. etc. DB/Models would be accessed via any other streaming application, which in turn is using Kafka streams here. Kafka Streams is built upon important stream processing concepts such as properly distinguishing between event time and processing time, windowing support, and simple (yet efficient) management of application state. It is based on many concepts already contained in Kafka, such as scaling by partitioning.Also, for this reason, it comes as a lightweight library that can be integrated into an application.The application can then be operated as desired, as mentioned below: Standalone, in an application serverAs a Docker container, or Directly, via a resource manager such as Mesos.Why one will love using dedicated Apache Kafka Streams?Elastic, highly scalable, fault-tolerantDeploy to containers, VMs, bare metal, cloudEqually viable for small, medium, & large use casesFully integrated with Kafka securityWrite standard Java and Scala applicationsExactly-once processing semanticsNo separate processing cluster requiredDevelop on Mac, Linux, WindowsApache Spark Streaming:Spark Streaming receives live input data streams, it collects data for some time, builds RDD, divides the data into micro-batches, which are then processed by the Spark engine to generate the final stream of results in micro-batches. Following data flow diagram explains the working of Spark streaming. Spark Streaming provides a high-level abstraction called discretized stream or DStream, which represents a continuous stream of data. DStreams can be created either from input data streams from sources such as Kafka, Flume, and Kinesis, or by applying high-level operations on other DStreams. Internally, a DStream is represented as a sequence of RDDs. Think about RDD as the underlying concept for distributing data over a cluster of computers. Why one will love using Apache Spark Streaming?It makes it very easy for developers to use a single framework to satisfy all the processing needs. They can use MLib (Spark's machine learning library) to train models offline and directly use them online for scoring live data in Spark Streaming. In fact, some models perform continuous, online learning, and scoring.Not all real-life use-cases need data to be processed at real real-time, few seconds delay is tolerated over having a unified framework like Spark Streaming and volumes of data processing. It provides a range of capabilities by integrating with other spark tools to do a variety of data processing.  Spark Streaming Vs Kafka StreamNow that we have understood high level what these tools mean, it’s obvious to have curiosity around differences between both the tools. Following table briefly explain you, key differences between the two. Sr.NoSpark streamingKafka Streams1Data received form live input data streams is Divided into Micro-batched for processing.processes per data stream(real real-time)2Separated processing Cluster is requriedNo separated processing cluster is requried.3Needs re-configuration for Scaling Scales easily by just adding java processes, No reconfiguration requried.4At least one semanticsExactly one semantics5Spark streaming is better at processing group of rows(groups,by,ml,window functions etc.)Kafka streams provides true a-record-at-a-time processing capabilities. it's better for functions like rows parsing, data cleansing etc.6Spark streaming is standalone framework.Kafka stream can be used as part of microservice,as it's just a library.Kafka streams Use-cases:Following are a couple of many industry Use cases where Kafka stream is being used: The New York Times: The New York Times uses Apache Kafka and Kafka Streams to store and distribute, in real-time, published content to the various applications and systems that make it available to the readers.Pinterest: Pinterest uses Apache Kafka and the Kafka Streams at large scale to power the real-time, predictive budgeting system of their advertising infrastructure. With Kafka Streams, spend predictions are more accurate than ever.Zalando: As the leading online fashion retailer in Europe, Zalando uses Kafka as an ESB (Enterprise Service Bus), which helps us in transitioning from a monolithic to a micro services architecture. Using Kafka for processing event streams enables our technical team to do near-real time business intelligence.Trivago: Trivago is a global hotel search platform. We are focused on reshaping the way travellers search for and compare hotels while enabling hotel advertisers to grow their businesses by providing access to a broad audience of travellers via our websites and apps. As of 2017, we offer access to approximately 1.8 million hotels and other accommodations in over 190 countries. We use Kafka, Kafka Connect, and Kafka Streams to enable our developers to access data freely in the company. Kafka Streams powers parts of our analytics pipeline and delivers endless options to explore and operate on the data sources we have at hand.Broadly, Kafka is suitable for microservices integration use cases and have wider flexibility.Spark Streaming Use-cases:Following are a couple of the many industries use-cases where spark streaming is being used: Booking.com: We are using Spark Streaming for building online Machine Learning (ML) features that are used in Booking.com for real-time prediction of behaviour and preferences of our users, demand for hotels and improve processes in customer support. Yelp: Yelp’s ad platform handles millions of ad requests every day. To generate ad metrics and analytics in real-time, they built the ad event tracking and analyzing pipeline on top of Spark Streaming. It allows Yelp to manage a large number of active ad campaigns and greatly reduce over-delivery. It also enables them to share ad metrics with advertisers in a timelier fashion.Spark Streaming’s ever-growing user base consists of household names like Uber, Netflix, and Pinterest.Broadly, spark streaming is suitable for requirements with batch processing for massive datasets, for bulk processing and have use-cases more than just data streaming. Dean Wampler explains factors to evaluation for tool basis Use-cases beautifully, as mentioned below: Sr.NoEvaluation CharacteristicResponse Time windowTypical Use Case Requirement1.Latency tolerancePico to Microseconds (Real Real time)Flight control system for space programs etc.Latency tolerance< 100 MicrosecondsRegular stock trading market transactions, Medical diagnostic equipment outputLatency tolerance< 10 millisecondsCredit cards verification window when consumer buy stuff onlineLatency tolerance< 100 millisecondshuman attention required Dashboards, Machine learning modelsLatency tolerance< 1 second to minutesMachine learning model trainingLatency tolerance1 minute and abovePeriodic short jobs(typical ETL applications)2.Evaluation CharacteristicTransaction/events frequencyTypical Use Case RequirementVelocity1M per secondNest Thermostat, Big spikes during specific time period.3Evaluation CharacteristicTypes of data processingNAData Processing Requirement1. SQLNA2. ETL3. Dataflow4. Training and/or Serving Machine learning modelsData Processing Requirement1. Bulk data processingNA2. Individual Events/Transaction processing4.Evaluation CharacteristicUse of toolNAFlexibility of implementation1. Kafka : flexible as provides library.NA2. Spark: Not flexible as it’s part of a distributed frameworkConclusionKafka Streams is still best used in a ‘Kafka -> Kafka’ context, while Spark Streaming could be used for a ‘Kafka -> Database’ or ‘Kafka -> Data science model’ type of context.Although, when these 2 technologies are connected, they bring complete data collection and processing capabilities together and are widely used in commercialized use cases and occupy significant market share. 
Rated 4.5/5 based on 19 customer reviews
10160
Apache Kafka Vs Apache Spark: Know the Differences

A new breed of ‘Fast Data’ architectures has e... Read More