Quiz 2

Big Data: Hadoop & Spark

349 words
2 min read
Python Week 1: the first filter for runtime behavior
Visual companion
Python
Type and operator map

Python Week 1: the first filter for runtime behavior

View
Revision summary

What this note is really saying

Short form

# Big Data: Hadoop & Spark ## 🎯 Learning Objectives - Explain the Hadoop ecosystem components - Understand HDFS architecture and data replication - Compare MapReduce and Spark processing models - Use Spark DataFrames for distributed data processing ## 📖 Core Content ### 4.1 The Hadoop Ecosystem *(Diagram)* ### 4.2...

Big Data: Hadoop & Spark

🎯 Learning Objectives

  • Explain the Hadoop ecosystem components
  • Understand HDFS architecture and data replication
  • Compare MapReduce and Spark processing models
  • Use Spark DataFrames for distributed data processing

📖 Core Content

4.1 The Hadoop Ecosystem

(Diagram)

4.2 HDFS Architecture

NameNode: Manages metadata (file system namespace). DataNode: Stores actual data blocks.
  • Default block size: 128 MB
  • Replication factor: 3 (default)
  • Rack awareness: Replicates across racks

4.3 MapReduce vs Spark

AspectMapReduceSpark
ProcessingDisk-based (writes to HDFS between stages)In-memory
SpeedSlow (disk I/O)10-100× faster
APIJava (verbose)Python, Scala, SQL, R
StreamingNot nativeStructured Streaming
MLMahout (limited)MLlib (comprehensive)
Fault toleranceTask re-executionLineage + recomputation

4.4 Spark DataFrame API

python
# runnable
# Note: Requires Spark installation - this is reference code
# from pyspark.sql import SparkSession
# from pyspark.sql.functions import col, avg, count
# spark = SparkSession.builder.appName("analysis").getOrCreate()
# df = spark.read.parquet("sales_data.parquet")
#
# result = df.groupBy("category").agg(
#     avg("revenue").alias("avg_revenue"),
#     count("*").alias("transaction_count")
# ).filter(col("avg_revenue") > 1000)
#
# result.show()

📝 Practice Questions

Q1: Why does HDFS use 128 MB blocks instead of smaller sizes?
Large block sizes minimize seek time overhead (seek ~10ms per block). A 128 MB block takes ~1 second to read at 128 MB/s — only 1% overhead from seek. Smaller blocks would waste more time seeking. Also reduces metadata storage on NameNode. Q2: Why is Spark faster than MapReduce?
MapReduce writes intermediate results to disk (HDFS) between map and reduce stages. Spark keeps data in memory across operations. For iterative algorithms (ML, graph processing), this eliminates disk I/O bottlenecks. Spark also has a more efficient DAG execution engine vs MapReduce's rigid 2-stage pipeline. Q3: What is a Data Lake versus a Data Warehouse in the Big Data context?
Data Lake (Hadoop-based): Stores raw data in native format (CSV, JSON, Parquet). Schema-on-read. Used for exploratory analysis, data science, and machine learning. Data Warehouse: Stores processed, structured data. Schema-on-write. Used for BI reporting and dashboards. Many organizations use both: Data Lake stores everything, Data Warehouse stores the refined subset. Join Discord PreviousOLAP & CubesNextNoSQL Databases
Document outline

Keep your place and jump directly to a heading.

Table of Contents
System Normal // Awaiting Context

Intelligence Hub

Navigate the knowledge graph to generate context. The Hub adapts dynamically to surface backlinks, related notes, and metadata insights.