Cloud MR
Cloud MR
MapReduce
Used slides from RAD Lab at UC Berkeley about the cloud ( http://abovetheclouds.cs.berkeley.edu/) and slides from Jimmy
Lin’s slides (http://www.umiacs.umd.edu/~jimmylin/cloud-2010-Spring/index.html) (licensed under Creation Commons
Attribution 3.0 License)
Cloud computing
• What is the “cloud”?
– Many answers. Easier to explain with
examples:
• Gmail is in the cloud
• Amazon (AWS) EC2 and S3 are the cloud
• Google AppEngine is the cloud
• Windows Azure is the cloud
• SimpleDB is in the cloud
• The “network” (cloud) is the computer
Cloud Computing
What about Wikipedia?
“Cloud computing is the delivery of
computing as a service rather than a product
, whereby shared resources, software, and
information are provided to computers and
other devices as a utility (like the
electricity grid) over a network (typically
the Internet). “
Cloud Computing
• Computing as a “service” rather than a “product”
– Everything happens in the “cloud”: both storage and computing
• Advantages
– Device agonstic – can seamlessly move from one device to other
– Efficiency/scalability: programming frameworks allow easy scalability
(relatively speaking)
• Increasing need to handle “Big Data”
– Reliability
Data Centers
• Power distribution
– Almost 11% lost in distribution – starts mattering when the
total power consumption is in millions
• Modular and pre-fab designs
– Fast and economic deployments, built in a factory
• Cooling/temperature/energy issues
– Appropriate placement of vents, inlets etc. a key issue
• Thermal hotspots often appear and need to worked around
– Overall cost of cooling is quite high
• So is the cost of running the computing equipment
– Both have led to issues in energy-efficient computing
– Hard to optimize PUE (Power Usage Effectiveness) in small data centers
• may lead to very large data centers in near future
• Ideally PUE should be 1, currently numbers are around 1.07-1.22
– 1.07 is a Facebook data center that does not have A/C
• MGHPCC in Holyoke, MA
• Cost: $95M
• 8.6 acres, 10,000 high-end computers with
hundreds of thousands of processor cores
• 10 MW power + 5MW for cooling/lighting
• Close to electricity sources (hydroelectric
plant)+ solar
• More: http://www.mghpcc.org/
Amazon Web Services
• Basic idea: run virtual machines on your servers and sell time on
them
– That’s how Amazon EC2 runs
• Many advantages:
– “Security”: virtual machines serves as “almost” impenetrable boundary
– Multi-tenancy: can have multiple VMs on the same server
– Efficiency: replace many underpowered machines with a few high-power
machines
Virtualization
• Consumer VM products include VMWare, Parallels (for Mac),
VirtualBox etc…
Resources
Demand
Time
How do you pick
Economics of Cloud Users a capacity level?
• Pay by use instead of provisioning for peak
• Recall: DC costs >$150M and takes 24+
months to design and build
Capacity
Resources
Resources
Demand Capacity
Demand
Time Time
Unused resources
Economics of Cloud Users
• Risk of over-provisioning: underutilization
• Huge sunk cost in infrastructure
Capacity
Unused resources
Resources
Demand
Resources
Capacity
Time
Demand
Static data center
1 2 3
Time (days)
Utility Computing Arrives
• Amazon Elastic Compute Cloud (EC2)
• “Compute unit” rental: $0.10-0.80 0.085-0.68/hour
– 1 CU ≈ 1.0-1.2 GHz 2007 AMD Opteron/Intel Xeon core
Platform Units Memory Disk
Small - $0.10 $.085/hour 32-bit 1 1.7GB 160GB
Large - $0.40 $0.35/hour 64-bit 4 7.5GB 850GB – 2 spindles
X Large - $0.80 $0.68/hour 64-bit 8 15GB 1690GB – 4 spindles
High CPU Med - $0.20 $0.17 64-bit 5 1.7GB 350GB
High CPU Large - $0.80 $0.68 64-bit 20 7GB 1690GB
High Mem X Large - $0.50 64-bit 6.5 17.1GB 1690GB
High Mem XXL - $1.20 64-bit 13 34.2GB 1690GB
High Mem XXXL - $2.40 64-bit 26 68.4GB 1690GB
• No up-front cost, no contract, no minimum
• Billing rounded to nearest hour (also regional,spot
pricing)
Utility Storage Arrives
• Amazon S3 and Elastic Block Storage offer
low-cost, contract-less storage
Programming Frameworks
• Third key piece emerged from efforts to “scale out”
– i.e., distribute work over large numbers of machines (1000’s of
machines)
• Even with VMs, I still need to know how to distribute work across multiple
VMs
– Amazon’s largest single instance may not be enough
Cloud Computing Infrastructure
• Computation model: MapReduce*
• Storage model: HDFS*
• Other computation models: HPC/Grid
Computing
• Network structure
*Some material adapted from slides by Jimmy Lin, Christophe Bisciglia, Aaron Kimball, & Sierra Michels-Slettvet,
Google Distributed Computing Seminar, 2007 (licensed under Creation Commons Attribution 3.0 License)
Cloud Computing Computation Models
• Finding the right level of abstraction
– von Neumann architecture vs cloud environment
• Hide system-level details from the developers
– No more race conditions, lock contention, etc.
• Separating the what from how
– Developer specifies the computation that needs to
be performed
– Execution framework (“runtime”) handles actual
execution
Similar to SQL!!
Typical Large-Data Problem
Map
• Iterate over a large number of records
• Extract something of interest
c e from each
Red u
• Shuffle and sort intermediate results
• Aggregate intermediate results
• Generate final output
Key idea: provide a functional abstraction for
these two operations – MapReduce
a 1 b 2 c 3 c 6 a 5 c 2 b 7 c 8
Shuffle and Sort: aggregate values by keys
a 15 b 27 c 2368
r1 s1 r2 s2 r3 s3
MapReduce
• Programmers specify two functions:
map (k, v) → <k’, v’>*
reduce (k’, v’) → <k’, v’>*
– All values with the same key are sent to the
same reducer
• The execution framework handles
everything else…
a 1 b 2 c 3 c 6 a 5 c 2 b 7 c 8
combine combine combine combine
a 1 b 2 c 9 a 5 c 2 b 7 c 8
partition partition partition partition
r1 s1 r2 s2 r3 s3
Two more details…
• Barrier between map and reduce phases
– But we can begin copying intermediate data
earlier
• Keys arrive at each reducer in sorted order
– No enforced ordering across reducers
MapReduce Overall Architecture
User
Program
(1) submit
Master
(2) schedule map (2) schedule reduce
worker
split 0 (5) remote read (6) writeoutput
split 1 (3) read worker file 0
split 2 (4) local write
split 3 worker
output
split 4 worker file 1
worker
SAN
Compute Nodes
instructions to datanode
datanode state
(block id, byte range)
HDFS datanode HDFS datanode
block data Linux file system Linux file system
… …
… … …
slave node slave node slave node
MapReduce/GFS Summary