0% found this document useful (0 votes)
12 views12 pages

Cloud Computing Lab Report

The document is a lab report from Padmakanya Multiple Campus detailing various cloud computing implementations. It includes labs on Remote Method Invocation (RMI), Remote Procedure Call (RPC), virtualization, network communication testing, client-server architecture in Cisco Packet Tracer, and MapReduce implementation. Each lab provides code examples and explanations of the processes involved.

Uploaded by

Prashant Bhatta
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views12 pages

Cloud Computing Lab Report

The document is a lab report from Padmakanya Multiple Campus detailing various cloud computing implementations. It includes labs on Remote Method Invocation (RMI), Remote Procedure Call (RPC), virtualization, network communication testing, client-server architecture in Cisco Packet Tracer, and MapReduce implementation. Each lab provides code examples and explanations of the processes involved.

Uploaded by

Prashant Bhatta
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Padmakanya Multiple Campus

Bagbazar,Kathmandu
Lab Report of Cloud Computing

Submitted By:​ Submitted To:


Samiksha Khadka​ Mr. Bhim Bahadur Rawat
Table of Content

LAB 1: Implement the RMI


LAB 2: Implement the RPC
LAB 3: Implementation of Virtualization
LAB 4: Test ping command to test the communication
between the guest OS and Host OS.
LAB 5: Implement client and server architecture in Cisco
packet tracer
LAB 6: Implement the map reduce
LAB 1: Implement the RMI: Sum of two number

Create Folder:
mkdir
RMIAddition cd
RMIAddition
mkdir server
mkdir client
mkdir
common

File:
common/[Link]
package common;
import [Link];
import [Link];

public interface AddService extends Remote {


int add(int a, int b) throws RemoteException;
}

server/[Link]
package server;
import [Link];
import
[Link];
import [Link];

public class AddServiceImpl extends UnicastRemoteObject implements AddService {


protected AddServiceImpl() throws RemoteException {
super();
}
public int add(int a, int b) throws RemoteException {
return a + b;
}}

server/[Link]
package server;
import [Link];
import
[Link];
import [Link];
public class Server {
public static void main(String[] args) {
try {
AddService addService = new AddServiceImpl();
Registry registry = [Link](1099);
[Link]("AddService", addService);
[Link]("Server is running...");
} catch (Exception e) {
[Link]();
}}}

client/[Link]
package client;
import [Link];
import
[Link];
import [Link];
import [Link];
public class Client {
public static void main(String[] args) {
try {
Registry registry = [Link]("localhost", 1099);
AddService stub = (AddService) [Link]("AddService");
Scanner scanner = new Scanner([Link]);
[Link]("Enter first number: ");
int a = [Link]();
[Link]("Enter second number: ");
int b = [Link]();
int result = [Link](a, b);
[Link]("Sum from server: " + result);
} catch (Exception e) {
[Link]();
}}}
Server side running

Client side running


LAB 2: Implement the RPC: Addition

Create Folder:
mkdir
RPCAddition cd
RPCAddition

Files:
[Link]
a
[Link]

[Link]
import [Link].*;
import [Link].*;
public class Server {
public static void main(String[] args) {
try (ServerSocket serverSocket = new ServerSocket(5000)) {
[Link]("Server is running...");
while (true) {
Socket socket = [Link]();
BufferedReader in = new BufferedReader(new
InputStreamReader([Link]()));
PrintWriter out = new PrintWriter([Link](), true);
String request = [Link](); // expects: add 5 7
String[] parts = [Link](" ");
if (parts[0].equals("add") && [Link] == 3) {
int a = [Link](parts[1]);
int b = [Link](parts[2]);
int result = a + b;
[Link]("Result: " + result);
} else {
[Link]("Invalid request");
}
[Link]();
}
} catch (IOException e) {
[Link]();
} } }

[Link]
import [Link].*;
import [Link].*;
import [Link];
public class Client {
public static void main(String[] args) {
try (Socket socket = new Socket("localhost", 5000)) {
PrintWriter out = new PrintWriter([Link](), true);
BufferedReader in = new BufferedReader(new
InputStreamReader([Link]()));
Scanner scanner = new Scanner([Link]);
[Link]("Enter first number: ");
int a = [Link]();
[Link]("Enter second number: ");
int b = [Link]();
[Link]("add " + a + " " +
b); String response =
[Link]();
[Link](response);
} catch (IOException e)
{ [Link]();
}
}
}

Server side running

Client side running


LAB 3: Implementation of Virtualization
A guest operating system is the operating system installed on either a virtual machine
(VM) or partitioned disk. Turbo C++3.0 is successfully installed on virtual machine linux
as shown in figure below.

Installation commands:

sudo apt install dosbox

dosbox

mount c ~/turbo-cpp

c:

cd TURBOC3\BIN

[Link]

Figure 1: Turbo C++ Installation


Lab 4: Test ping command to test the communication between the guest
OS and Host OS.

To test the ping command between guest OS and Host OS, ip address is pinged which is
demonstrated by the below figure.

Figure 4: Ping command in guest OS

ipconfig /all
Figure 5: ipconfig in Host OS
LAB 5: Implement client and server architecture in Cisco packet tracer

A network where:
A Client PC sends a request to
A Server (e.g., HTTP or DNS server),
Through a Switch or directly connected, depending on setup
Tools
1 Server (from End Devices)
1 or 3 PCs (from End Devices)
1 Switch (optional)
Copper Straight-Through Cables (from Connections)
LAB 6: Implement the map reduce

Folder: mapreduce
File:
[Link]
[Link]
[Link]

[Link]
import [Link].*;
public class Mapper {
// Simulates the Map step: splits lines into words, outputs (word, 1)
public List<[Link]<String, Integer>> map(String line) {
List<[Link]<String, Integer>> results = new ArrayList<>();
String[] words = [Link]().split("\\W+");
for (String word : words) {
if ([Link]() > 0) {
[Link](new [Link]<>(word, 1));
}
}
return results;
}
}

[Link]
import [Link].*;
public class Reducer {
// Simulates the Reduce step: sums counts for each word
public Map<String, Integer> reduce(List<[Link]<String, Integer>> mappedData) {
Map<String, Integer> wordCounts = new HashMap<>();
for ([Link]<String, Integer> entry : mappedData) {
[Link]([Link](), [Link]([Link](), 0)
+
[Link]());
}
return wordCounts;
}
}

[Link]
import [Link].*;
public class MapReduceDriver {
public static void main(String[] args) {
String[] input = {
"Hello world",
"Hello from ChatGPT",
"Distributed systems are fun",
"Hello distributed world"
};
Mapper mapper = new Mapper();
Reducer reducer = new Reducer();
List<[Link]<String, Integer>> mappedResults = new ArrayList<>();
// Map step
for (String line : input) {
[Link]([Link](line));
}
// Reduce step
Map<String, Integer> finalCounts = [Link](mappedResults);
// Print the result
for ([Link]<String, Integer> entry : [Link]()) {
[Link]([Link]() + " : " + [Link]());
}
}

Common questions

Powered by AI

Java serialization is critical in RMI as it allows objects to be converted into byte streams for transportation across network boundaries. In the RMI example, when a method call is made on the client side, its parameters and possibly the return value are serialized, sent over the network, and deserialized at the remote end. This enables the RMI to appear seamless, as if operations on remote objects were local, while hiding the complexities of network communication .

In this simple MapReduce framework, the `Mapper` class processes input strings, splits them into words, and outputs a list of `<word, count>` pairs, where the count is initially 1 for each word encountered . The `Reducer` class aggregates these pairs by summing the counts for each unique word, resulting in a map of word frequencies . These classes interact by having the `MapReduceDriver` first execute the map step to generate mapped data, which is then provided to the reduce step to compute the final word counts, demonstrating the division of labor between mapping and reducing in parallel data processing .

Implementing RMI for a distributed arithmetic operation involves challenges like handling network errors, serialization of objects, and remote reference setup. Solutions include utilizing Java's RMI features which abstract much of the network and object handling complexity, but developers still need to manage exceptions like `RemoteException`, ensure the RMI registry is running, and appropriately configure security settings for remote method invocations . Additionally, separating concerns between interface definition and implementation helps manage code complexity and reusability .

Virtualization allows the Turbo C++3.0 to operate within a DOS-like environment under Linux using dosbox, effectively isolating the application in its dedicated environment. This approach leverages the flexibility of virtual machines to run legacy software without compatibility issues while conserving resources by utilizing shared computing resources of the host system, as demonstrated by the installation procedures in Lab 3 .

Testing network communication using the ping command verifies the connectivity between the Host OS and Guest OS by sending Internet Control Message Protocol (ICMP) Echo Requests to an IP address and awaiting Echo Replies. This test demonstrates that the virtual networking setup is correctly configured, which is crucial in environments requiring seamless interaction between host and virtualized systems, ensuring data can reach and be received across these systems .

RMI is based on Java and enables invoking methods on a remote object as if it were a local object, relying on Java's serialization to pass complex objects. In contrast, RPC is a protocol independent of language, which in this context uses raw sockets to send plain text commands and receive results. RMI handles remote objects and network communication details through Java's built-in features, while RPC requires manual handling of socket communication and parsing of request/response strings .

Implementing MapReduce in a classroom setting, as shown in Lab 6, is educationally important as it introduces students to distributed computing principles and big data processing techniques. By simulating real-world data partitioning and aggregation tasks, students can grasp the concepts of scalability, parallel processing, and the challenges in handling large datasets. This hands-on approach facilitates experiential learning and prepares students for complex data management scenarios in professional environments .

The AddService interface is defined in the package `common`, extending `java.rmi.Remote` and includes a method `int add(int a, int b) throws RemoteException` . On the server side, it's implemented by `AddServiceImpl`, a class extending `UnicastRemoteObject`. This implementation provides the specific logic for adding two integers and handling remote requests . The server registers this object with the RMI registry under the name 'AddService' . On the client side, the application retrieves the stub using the RMI registry lookup method and interacts with it to perform remote invocations using the `add` method .

Lab 4 demonstrates an understanding of network layer functionalities by using the `ping` command to test connectivity between the guest and host operating systems. This process involves sending ICMP packets across the network to the target IP address and interpreting the response results. Successfully pinging confirms that packets travel across the network layer correctly, showcasing its core role in routing data between connected devices .

Setting up a client-server architecture in Cisco Packet Tracer involves selecting network devices, such as a server from End Devices and PCs as clients, connecting them through a switch or direct cabling using Copper Straight-Through cables. These setups allow simulation of real-world networks where client machines communicate requests to the server, e.g., HTTP or DNS . This simulation helps learners visualize network topologies, understand protocols and data flow, and experiment with network configurations without needing physical hardware .

You might also like