











Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!












Large-scale algorithms are designed to solve gigantic, complex problems that cannot be handled by a single computer or processor. These algorithms are characterized by their need for multiple execution engines (like multiple processors, GPUs, or distributed systems) due to the massive scale of data and processing requirements. Let’s break this down step by step.
Key Characteristics of Large-Scale Algorithms
Terminologies in Large-Scale Algorithms
● Definition: The total time taken to perform a single computation from start to finish. ● Example: If a computation starts at time t₁ and ends at t₂ , the latency is t₂ - t₁. ● Importance: Low latency is critical for real-time applications like video streaming or online gaming.
● Definition: The ability of the system to dynamically provision more resources (like servers or storage) when the workload increases. ● Example: Cloud platforms like AWS or Azure can automatically add more servers during peak traffic. ● Importance: Elasticity ensures that the system can handle sudden spikes in demand without crashing.
Amdahl's Law: Understanding Parallel Processing
Amdahl's Law helps us understand the limits of parallel processing. It states that not all parts of a computation can be parallelized. Some parts are inherently sequential and must run one after the other.
Example:
● Suppose a process P takes 11 seconds to run on a single node. ○ P₁ (Sequential Part): Takes 2 seconds (e.g., scanning files). ○ P₂ (Parallelizable Part): Takes 9 seconds (e.g., processing files). If we use 3 nodes to parallelize P₂ , the time for P₂ reduces to 3 seconds. However, P₁ remains 2 seconds because it cannot be parallelized. So, the total time for P becomes 2 + 3 = 5 seconds.
Amdahl's Formula:
● b: Fraction of the process that can be parallelized (e.g., 9/11 = 81.81%). ● s: Speedup factor (e.g., 3 nodes).
Challenges in Parallel Processing (GBL)
Introducing CUDA: Parallel Processing on GPUs
What is CUDA?
● CUDA (Compute Unified Device Architecture) is a platform developed by NVIDIA for parallel computing on GPUs. ● GPUs are designed for data-parallel tasks (e.g., processing millions of pixels in an image).
Why Use GPUs? ● GPUs have thousands of cores (compared to a CPU's few cores), making them ideal for parallel tasks. ● Example: Processing a 1920x1200 image (2.3 million pixels) can be done in constant time by mapping each pixel to a GPU thread.
Applications of CUDA:
● Machine Learning: Preparing data and training models. ● Scientific Simulations: Weather forecasting, DNA analysis. ● Multimedia Processing: Video and image analysis.
Cluster Computing: Distributed Parallel Processing
What is Cluster Computing?
● A cluster is a group of computers (nodes) connected over a high-speed network. ● Large-scale algorithms are divided into tasks and distributed across the cluster.
Apache Spark:
● A popular framework for cluster computing. ● Data is divided into Resilient Distributed Datasets (RDDs) , which are processed in parallel across nodes. ● Example: Analyzing terabytes of log data or training machine learning models on large datasets.
Hybrid Strategy: Combining GPUs and Distributed Computing
How It Works:
Example:
● A cloud platform like AWS allows you to provision GPU-enabled virtual machines. You can use these machines to run large-scale algorithms by combining distributed computing (across nodes) and GPU processing (within each node).
Hadoop is like a super-smart system designed to store and process huge amounts of data (like gigabytes, terabytes, or even petabytes). It’s open-source, meaning anyone can use and modify it for free. Hadoop is especially useful for big data applications, where traditional systems struggle to handle the volume, speed, and variety of data. Hadoop works by distributing data and tasks across many computers (called a cluster ) instead of relying on a single machine. This makes it faster, more reliable, and cost-effective.
Key Components of Hadoop
Hadoop has four main parts that work together:
HDFS is like a giant, super-reliable storage system for big data. It splits large files into smaller chunks (called blocks ) and stores them across multiple machines in a cluster. This way, even if one machine fails, your data is still safe.
How HDFS Works: ● NameNode (Master): Think of this as the "boss" of the storage system. It keeps track of where all the data blocks are stored but doesn’t store the actual data itself. It’s like a librarian who knows where every book is in the library. ● DataNodes (Slaves): These are the "workers" that store the actual data blocks. They report back to the NameNode regularly to say, "Hey, I’m still here, and I have these blocks!"
Key Features of HDFS:
● Scalability: You can add more machines (DataNodes) to store more data. ● Fault Tolerance: If a machine fails, HDFS has backups (replicas) of the data on other machines. ● High Throughput: It’s designed to handle large amounts of data quickly.
Example: Imagine you have a 1 GB file. HDFS splits it into 8 blocks (each 128 MB) and stores them on different machines. If one machine crashes, you can still access the file because the blocks are replicated on other machines.
Hadoop Common is like the "toolbox" for Hadoop. It provides shared tools and libraries that all the other components (HDFS, MapReduce, YARN) need to work. Without Hadoop Common, the other parts wouldn’t function properly.
What Hadoop Common Does:
● Provides essential libraries for file systems, networking, and security. ● Ensures all Hadoop components can talk to each other. ● Handles basic tasks like reading/writing files and managing hardware failures.
Example:
Think of Hadoop Common as the foundation of a house. Without a strong foundation, the walls (HDFS), roof (MapReduce), and plumbing (YARN) wouldn’t hold up.
Why is Hadoop Important?
Real-Life Example of Hadoop in Action
Imagine you’re running a social media platform with millions of users. Every day, users upload photos, post comments, and like posts. Here’s how Hadoop helps:
Setting Up Hadoop
Hadoop can be set up in three configurations, depending on your needs:
Best Practices for Hadoop Deployment
Here’s how to set up and manage Hadoop effectively:
Feature Apache Pig Apache Sqoop Apache Drill
Purpos e
Platform for managing and analyzing large datasets using high-level programming.
Tool for transferring data between Hadoop and relational databases.
Open-source query engine for interactive analysis of large-scale datasets.
Langua ge
Pig Latin (textual language). Command-line tools. SQL (supports standard SQL).
Key Feature s
Use Cases
When to Use Which?
Feature Apache Hive Apache HBase
1. Purpose For batch processing and data warehousing.
For real-time access to large datasets.
2. Processing Type
Uses batch processing (MapReduce/Tez).
Uses real-time processing (low-latency reads/writes).
3. Architecture - Converts SQL-like queries ( HiveQL ) into MapReduce/Tez jobs. - Stores data in column families and uses row keys for fast access. - Stores metadata in a metastore. - Data is split into regions and distributed across servers. - Works with HDFS for storage. - Uses ZooKeeper to manage servers and ensure fault tolerance. 4. Schema Needs a fixed schema (structured data).
No fixed schema (unstructured data).
5. SQL Support Supports HiveQL (SQL-like queries). No native SQL; uses Apache Phoenix for SQL queries. 6. Data Model Works like a traditional table (rows and columns).
Stores data in columns grouped into families , with timestamps.
7. Use Cases - Analyzing static data (e.g., logs, historical data). - Real-time apps (e.g., messaging, recommendations). - Batch processing of large datasets. - Handling sparse datasets (e.g., user profiles, sensor data). 8. Scalability Scales well for batch jobs and large datasets.
Scales across thousands of servers for real-time access.
● Use HBase if: ○ You need real-time access to data (e.g., for apps). ○ Your data is unstructured or sparse. ○ You need low-latency reads and writes.
HBase Data Model
● Column-Oriented: Data is stored in columns grouped into column families. ● Row Key: Each row is identified by a unique row key. ● Versions: Each cell (row + column) can store multiple versions of data, marked by a timestamp. ● Dynamic Columns: Columns can be added on the fly (no fixed schema). ● Sparse Data: Efficiently handles sparse datasets (where many cells are empty). Example:
Row Key Column Family: User Column Family: Activity
User1 User:Name = "Alice" Activity:Login = "2023-10-01"
User:Age = 25 Activity:Purchase = "2023-10-02"
User2 User:Name = "Bob" Activity:Login = "2023-10-03"
HBase Architecture
● Master-Slave Model: ○ HMaster: Manages metadata, table creation, and region assignment. ○ RegionServers: Store and manage data in regions (subsets of tables). ● Regions: Tables are split into regions , which are distributed across RegionServers. ● ZooKeeper: Coordinates between HMaster and RegionServers, ensuring fault tolerance. ● HDFS: Data is stored in HDFS (Hadoop Distributed File System) for durability. ● Auto-Sharding: Tables are automatically split into regions as they grow. How it Works: