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

Google BigQuery

1.6K
1.5K
+ 1
152
Apache Spark

2.9K
3.5K
+ 1
140
Add tool

Apache Spark vs Google BigQuery: What are the differences?

Apache Spark and Google BigQuery are two popular tools used for processing and analyzing large amounts of data. Let's explore the key differences between them.

  1. Data Processing Model: Apache Spark is a distributed computing system that allows for parallel processing of large datasets. It provides a flexible and powerful programming model that supports various data processing tasks, such as transformations and aggregations. On the other hand, Google BigQuery is a fully managed, serverless data warehouse that excels in performing ad-hoc queries on large datasets. It provides a SQL-like interface for querying data, making it easier for data analysts and business users to work with.

  2. Data Storage: Apache Spark does not provide its own storage system but can work with various data sources including Hadoop Distributed File System (HDFS), Amazon S3, and more. It allows users to read and write data from these sources using different file formats. In contrast, Google BigQuery stores data in its own proprietary storage system, based on Google's infrastructure. It offers support for nested and repeated fields, making it suitable for storing structured and semi-structured data.

  3. Cost Structure: Apache Spark is an open-source project, which means it can be used for free. However, deploying and managing a Spark cluster can incur costs for hardware, storage, and administration. On the other hand, Google BigQuery follows a pay-as-you-go pricing model. Users are charged based on the amount of data processed and the types of queries executed. It provides a flexible and scalable pricing structure, allowing users to control costs according to their needs.

  4. Performance: Apache Spark is designed to optimize the performance of data processing tasks through its in-memory computing capabilities and advanced optimization techniques. It can handle complex workflows and iterative algorithms efficiently, making it suitable for machine learning and real-time analytics. Google BigQuery, on the other hand, is optimized for running ad-hoc queries on large datasets. It uses a distributed processing engine that automatically parallelizes and executes queries, ensuring fast response times.

  5. Scalability: Apache Spark is highly scalable and can be easily scaled up or down based on the workload. It supports parallel processing of data across multiple nodes, allowing for efficient utilization of resources. Google BigQuery is also scalable and can handle massive amounts of data, thanks to its distributed storage and processing capabilities. It automatically distributes data across multiple nodes and transparently partitions queries, enabling high-performance data analysis.

  6. Ecosystem and Integration: Apache Spark has a rich ecosystem with a wide range of libraries and tools for various data processing tasks. It supports integration with popular frameworks and systems like Hadoop, Kafka, and more. This makes it easy to incorporate Spark into existing data workflows. On the other hand, Google BigQuery is tightly integrated with other Google Cloud services, such as Google Cloud Storage, Google Dataflow, and Google Analytics. It offers seamless data transfer and integration with these services, enabling a full-stack data processing and analytics solution.

In summary, Apache Spark, an open-source distributed computing framework, provides flexibility and scalability for processing data across clusters, with support for various programming languages and custom analytics workflows. Google BigQuery, a fully managed cloud data warehouse, offers serverless, scalable analytics with SQL-like querying capabilities and seamless integration with other Google Cloud services, making it ideal for organizations looking for a managed solution with minimal operational overhead.

Advice on Google BigQuery and Apache Spark
Nilesh Akhade
Technical Architect at Self Employed · | 5 upvotes · 519.1K 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 · 363.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
Decisions about Google BigQuery and Apache Spark
Julien Lafont

Cloud Data-warehouse is the centerpiece of modern Data platform. The choice of the most suitable solution is therefore fundamental.

Our benchmark was conducted over BigQuery and Snowflake. These solutions seem to match our goals but they have very different approaches.

BigQuery is notably the only 100% serverless cloud data-warehouse, which requires absolutely NO maintenance: no re-clustering, no compression, no index optimization, no storage management, no performance management. Snowflake requires to set up (paid) reclustering processes, to manage the performance allocated to each profile, etc. We can also mention Redshift, which we have eliminated because this technology requires even more ops operation.

BigQuery can therefore be set up with almost zero cost of human resources. Its on-demand pricing is particularly adapted to small workloads. 0 cost when the solution is not used, only pay for the query you're running. But quickly the use of slots (with monthly or per-minute commitment) will drastically reduce the cost of use. We've reduced by 10 the cost of our nightly batches by using flex slots.

Finally, a major advantage of BigQuery is its almost perfect integration with Google Cloud Platform services: Cloud functions, Dataflow, Data Studio, etc.

BigQuery is still evolving very quickly. The next milestone, BigQuery Omni, will allow to run queries over data stored in an external Cloud platform (Amazon S3 for example). It will be a major breakthrough in the history of cloud data-warehouses. Omni will compensate a weakness of BigQuery: transferring data in near real time from S3 to BQ is not easy today. It was even simpler to implement via Snowflake's Snowpipe solution.

We also plan to use the Machine Learning features built into BigQuery to accelerate our deployment of Data-Science-based projects. An opportunity only offered by the BigQuery solution

See more
Get Advice from developers at your company using StackShare Enterprise. Sign up for StackShare Enterprise.
Learn More
Pros of Google BigQuery
Pros of Apache Spark
  • 28
    High Performance
  • 25
    Easy to use
  • 22
    Fully managed service
  • 19
    Cheap Pricing
  • 16
    Process hundreds of GB in seconds
  • 12
    Big Data
  • 11
    Full table scans in seconds, no indexes needed
  • 8
    Always on, no per-hour costs
  • 6
    Good combination with fluentd
  • 4
    Machine learning
  • 1
    Easy to manage
  • 0
    Easy to learn
  • 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 Google BigQuery
Cons of Apache Spark
  • 1
    You can't unit test changes in BQ data
  • 4
    Speed

Sign up to add or upvote consMake informed product decisions

- No public GitHub repository available -

What is Google BigQuery?

Run super-fast, SQL-like queries against terabytes of data in seconds, using the processing power of Google's infrastructure. Load data with ease. Bulk load your data using Google Cloud Storage or stream it in. Easy access. Access BigQuery by using a browser tool, a command-line tool, or by making calls to the BigQuery REST API with client libraries such as Java, PHP or Python.

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!

What companies use Google BigQuery?
What companies use Apache Spark?
See which teams inside your own company are using Google BigQuery 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 Google BigQuery?
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
2138
MySQLKafkaApache Spark+6
2
2003
Aug 28 2019 at 3:10AM

Segment

PythonJavaAmazon S3+16
7
2555
Jul 2 2019 at 9:34PM

Segment

Google AnalyticsAmazon S3New Relic+25
10
6749
What are some alternatives to Google BigQuery and Apache Spark?
Google Cloud Bigtable
Google Cloud Bigtable offers you a fast, fully managed, massively scalable NoSQL database service that's ideal for web, mobile, and Internet of Things applications requiring terabytes to petabytes of data. Unlike comparable market offerings, Cloud Bigtable doesn't require you to sacrifice speed, scale, or cost efficiency when your applications grow. Cloud Bigtable has been battle-tested at Google for more than 10 years—it's the database driving major applications such as Google Analytics and Gmail.
Amazon Redshift
It is optimized for data sets ranging from a few hundred gigabytes to a petabyte or more and costs less than $1,000 per terabyte per year, a tenth the cost of most traditional data warehousing solutions.
Hadoop
The Apache Hadoop software library is a framework that allows for the distributed processing of large data sets across clusters of computers using simple programming models. It is designed to scale up from single servers to thousands of machines, each offering local computation and storage.
Snowflake
Snowflake eliminates the administration and management demands of traditional data warehouses and big data platforms. Snowflake is a true data warehouse as a service running on Amazon Web Services (AWS)—no infrastructure to manage and no knobs to turn.
Google Analytics
Google Analytics lets you measure your advertising ROI as well as track your Flash, video, and social networking sites and applications.
See all alternatives