Need advice about which tool to choose?Ask the StackShare community!

Celery

1.6K
1.6K
+ 1
280
Apache Spark

2.9K
3.5K
+ 1
140
Add tool

Apache Spark vs Celery: What are the differences?

Introduction

Apache Spark and Celery are both distributed computing frameworks used for processing large amounts of data. While they have some similarities, there are several key differences between them that make them suited for different use cases.

  1. Execution Model: Apache Spark uses a distributed computing model where data is processed in parallel across a cluster of machines. It provides a high-level API and supports various programming languages. On the other hand, Celery is a task queue system that allows you to distribute tasks across worker nodes. It follows a message-passing model where tasks are executed asynchronously.

  2. Data Processing Paradigm: Spark is designed for big data processing and provides a rich set of built-in libraries for batch processing, streaming, machine learning, and graph processing. It supports in-memory data processing and can handle large-scale data processing efficiently. In contrast, Celery is more focused on task scheduling and message passing. It does not provide built-in tools for complex data processing tasks like Spark.

  3. Fault Tolerance: Spark provides fault tolerance through its Resilient Distributed Dataset (RDD) abstraction. RDDs are fault-tolerant data structures that can be stored in memory and recalculated if a node fails. This allows Spark to recover from failures and continue processing without losing data. Celery, on the other hand, does not provide built-in fault tolerance mechanisms. If a worker fails, the task may need to be rescheduled or reprocessed manually.

  4. Integration with Ecosystem: Apache Spark is part of a larger ecosystem known as the Apache Big Data Stack. It can integrate with other Apache projects like Hadoop, Hive, and HBase, making it suitable for building end-to-end big data solutions. Celery, on the other hand, is a standalone task queue system and does not have built-in integrations with big data technologies.

  5. Concurrency Model: Spark uses a master-worker architecture where a central driver program coordinates the execution of tasks on worker nodes. This allows Spark to leverage parallelism and distribute work efficiently. Celery, on the other hand, uses a decentralized architecture where tasks are executed independently by worker nodes. This makes Celery more scalable and flexible for task distribution.

  6. Community and Documentation: Apache Spark has a large and active community with extensive documentation, tutorials, and resources available. It is widely adopted in industry and has a mature ecosystem. Celery also has a community and documentation, but it is not as extensive or mature as Spark's community.

In summary, Apache Spark and Celery are both distributed computing frameworks, but they have key differences in their execution model, data processing paradigm, fault tolerance, integration with the ecosystem, concurrency model, and community/documentation. Spark is more suited for big data processing with its rich set of libraries and integration with big data technologies, while Celery focuses on task scheduling and message passing.

Advice on Celery and Apache Spark
Needs advice
on
CeleryCelery
and
RabbitMQRabbitMQ

I am just a beginner at these two technologies.

Problem statement: I am getting lakh of users from the sequel server for whom I need to create caches in MongoDB by making different REST API requests.

Here these users can be treated as messages. Each REST API request is a task.

I am confused about whether I should go for RabbitMQ alone or Celery.

If I have to go with RabbitMQ, I prefer to use python with Pika module. But the challenge with Pika is, it is not thread-safe. So I am not finding a way to execute a lakh of API requests in parallel using multiple threads using Pika.

If I have to go with Celery, I don't know how I can achieve better scalability in executing these API requests in parallel.

See more
Replies (1)
Recommends
on
rqrqRedisRedis

For large amounts of small tasks and caches I have had good luck with Redis and RQ. I have not personally used celery but I am fairly sure it would scale well, and I have not used RabbitMQ for anything besides communication between services. If you prefer python my suggestions should feel comfortable.

Sorry I do not have a more information

See more
Nilesh Akhade
Technical Architect at Self Employed · | 5 upvotes · 527.9K views

We have a Kafka topic having events of type A and type B. We need to perform an inner join on both type of events using some common field (primary-key). The joined events to be inserted in Elasticsearch.

In usual cases, type A and type B events (with same key) observed to be close upto 15 minutes. But in some cases they may be far from each other, lets say 6 hours. Sometimes event of either of the types never come.

In all cases, we should be able to find joined events instantly after they are joined and not-joined events within 15 minutes.

See more
Replies (2)
Recommends
on
ElasticsearchElasticsearch

The first solution that came to me is to use upsert to update ElasticSearch:

  1. Use the primary-key as ES document id
  2. Upsert the records to ES as soon as you receive them. As you are using upsert, the 2nd record of the same primary-key will not overwrite the 1st one, but will be merged with it.

Cons: The load on ES will be higher, due to upsert.

To use Flink:

  1. Create a KeyedDataStream by the primary-key
  2. In the ProcessFunction, save the first record in a State. At the same time, create a Timer for 15 minutes in the future
  3. When the 2nd record comes, read the 1st record from the State, merge those two, and send out the result, and clear the State and the Timer if it has not fired
  4. When the Timer fires, read the 1st record from the State and send out as the output record.
  5. Have a 2nd Timer of 6 hours (or more) if you are not using Windowing to clean up the State

Pro: if you have already having Flink ingesting this stream. Otherwise, I would just go with the 1st solution.

See more
Akshaya Rawat
Senior Specialist Platform at Publicis Sapient · | 3 upvotes · 370.4K views
Recommends
on
Apache SparkApache Spark

Please refer "Structured Streaming" feature of Spark. Refer "Stream - Stream Join" at https://spark.apache.org/docs/latest/structured-streaming-programming-guide.html#stream-stream-joins . In short you need to specify "Define watermark delays on both inputs" and "Define a constraint on time across the two inputs"

See more
Get Advice from developers at your company using StackShare Enterprise. Sign up for StackShare Enterprise.
Learn More
Pros of Celery
Pros of Apache Spark
  • 99
    Task queue
  • 63
    Python integration
  • 40
    Django integration
  • 30
    Scheduled Task
  • 19
    Publish/subsribe
  • 8
    Various backend broker
  • 6
    Easy to use
  • 5
    Great community
  • 5
    Workflow
  • 4
    Free
  • 1
    Dynamic
  • 61
    Open-source
  • 48
    Fast and Flexible
  • 8
    One platform for every big data problem
  • 8
    Great for distributed SQL like applications
  • 6
    Easy to install and to use
  • 3
    Works well for most Datascience usecases
  • 2
    Interactive Query
  • 2
    Machine learning libratimery, Streaming in real
  • 2
    In memory Computation

Sign up to add or upvote prosMake informed product decisions

Cons of Celery
Cons of Apache Spark
  • 4
    Sometimes loses tasks
  • 1
    Depends on broker
  • 4
    Speed

Sign up to add or upvote consMake informed product decisions

What is Celery?

Celery is an asynchronous task queue/job queue based on distributed message passing. It is focused on real-time operation, but supports scheduling as well.

What is Apache Spark?

Spark is a fast and general processing engine compatible with Hadoop data. It can run in Hadoop clusters through YARN or Spark's standalone mode, and it can process data in HDFS, HBase, Cassandra, Hive, and any Hadoop InputFormat. It is designed to perform both batch processing (similar to MapReduce) and new workloads like streaming, interactive queries, and machine learning.

Need advice about which tool to choose?Ask the StackShare community!

Jobs that mention Celery and Apache Spark as a desired skillset
What companies use Celery?
What companies use Apache Spark?
See which teams inside your own company are using Celery or Apache Spark.
Sign up for StackShare EnterpriseLearn More

Sign up to get full access to all the companiesMake informed product decisions

What tools integrate with Celery?
What tools integrate with Apache Spark?

Sign up to get full access to all the tool integrationsMake informed product decisions

Blog Posts

Mar 24 2021 at 12:57PM

Pinterest

GitJenkinsKafka+7
3
2156
MySQLKafkaApache Spark+6
2
2014
Aug 28 2019 at 3:10AM

Segment

PythonJavaAmazon S3+16
7
2568
GitHubPythonNode.js+47
55
72395
What are some alternatives to Celery and Apache Spark?
RabbitMQ
RabbitMQ gives your applications a common platform to send and receive messages, and your messages a safe place to live until received.
Kafka
Kafka is a distributed, partitioned, replicated commit log service. It provides the functionality of a messaging system, but with a unique design.
Airflow
Use Airflow to author workflows as directed acyclic graphs (DAGs) of tasks. The Airflow scheduler executes your tasks on an array of workers while following the specified dependencies. Rich command lines utilities makes performing complex surgeries on DAGs a snap. The rich user interface makes it easy to visualize pipelines running in production, monitor progress and troubleshoot issues when needed.
Cucumber
Cucumber is a tool that supports Behaviour-Driven Development (BDD) - a software development process that aims to enhance software quality and reduce maintenance costs.
JavaScript
JavaScript is most known as the scripting language for Web pages, but used in many non-browser environments as well such as node.js or Apache CouchDB. It is a prototype-based, multi-paradigm scripting language that is dynamic,and supports object-oriented, imperative, and functional programming styles.
See all alternatives