Programming Models for Cloud Computing
The approaches, styles, or paradigms used by programmers to design and implement
applications that run on cloud platforms.
Since cloud systems are distributed (spread across many servers), we need special
models to:
• Split tasks into smaller parts,
• Run them in parallel on many machines,
• Handle communication between machines,
• Manage failures, scalability
• Efficient resource usage.
Examples of Cloud Programming Models
1.MapReduce:
• MapReduce is a parallel programming model developed by Google
• MapReduce uses a parallel programming paradigm for computation of
a large amount of data by partitioning or segregating them into several
pieces, processing them in parallel, and then combining them to
generate a single result. These processes are called map and reduce,
respectively.
• The first step in the map and reduce functions involves segregation of
large data and sending it to map function. The map function performs
map operation on data. Subsequently, the data are sent for reduce
operation where the actual results are obtained.
Map Function:
First, the large data are traced and segregated as key/value pairs. The map
function accepts the key/value pair and returns an intermediate key/value pair.
Usually, a map function works on a single document. The following formula
depicts the exact operation:
Map(Key1, Val1) → List(Key2, Val2)
The list of key/value pair obtained is subsequently sent to the reduce function.
Reduce Function:
Once the list of key/value pair is prepared after the map functions, a sort and merge
operation is applied on these key/value pairs. Usually, reduce function works on a
single word. Input of distinct key/value pair is given and in return the group with the
same key/value pair is obtained, as shown in the following equation:
Reduce(Key2, List(Val2)) → List(Val3)
The resultant values give the final set of result.
Example: counting the words in a file
Key features:
• Supports parallel programming
• Fast
• Can handle a large amount of data
2. Cloud Haskell: Functional Programming
Cloud Haskell is based on the Haskell functional programming language.
These functional programming languages are function based and work like
mathematical functions. Usually, the output here is based on the input value only.
Functional programming consists of components that are often immutable.
Here, in Cloud Haskell, the immutable components form the basis. Immutable
components are the components whose states cannot be modified after they have
been created.
The programming model is completely based on message-passing interface, which
can be used for highly reliable real-time application.
Key Features:
• Immutable components – states cannot be changed, ensuring reliability.
• Concurrency support – handles multiple tasks at the same time without interruptions.
• Fault tolerance – inspired by Erlang’s model; failed processes can restart independently
without affecting others.
• Cost model – less cost and estimates communication cost between processes (new addition
compared to standard Haskell)..
• Idempotency – functions can restart safely from any point after failure.
• Purely Functional.
• No shared memory