Simulating Virtualization in Cloudsim

Virtualization technology is not new, If you ever read about mainframes like IBM CP/CMS, these were first of it a kind of computer that implemented the virtualization at the hardware level. Back then in the early 1970s, the cost of computing resources was very high they were supposed to be shared for various operational purposes with application backward compatibility.

Then over the period of time, as the cost of computing decreased it become distributed to personal. This change helped virtualization to diversify its role in storage, network, application execution environment and has become a well-matured technology.

Also, since 1990 when the internet becomes public, within 15-20 years there has been exponential growth in the websites and applications hosted across the internet. This growth has intense stress on the service providers in terms of workload, operational, and maintenance costs. Apart from this increased use of computation required intense cooling measures which leads to indirect contribution of greenhouse gas emissions as most of the electricity is produced through burning the natural resources.

The service providers like Google, Microsoft, AWS worked around this problem and used virtualization technology as a great tool to have a sustained comprehensive computing practice by integrating Virtualization in cloud computing.

This is how virtualization becomes a fundamental component of a cloud computing stack because it allows the creation of a secure, customizable, and isolated abstract execution environment for running the application. This abstract execution environment completely separates the underlined host through the inception of hypervisor which is basically virtual machine managers. There have been various types of Virtualization in cloud computing, based on the type of resource is involved.

Apart from this, virtualization provides a great opportunity to build elastically scalable systems, which are capable of provisioning additional capacity with minimum cost as the underlying host machines are shared among various virtual machines. Ultimately leading to the Infrastructure as a service that can be offered on a pay as you go model.

Even though this technology has brought a huge difference to the real computing paradigm but as a cloud computing researcher it is really difficult to leverage such a commercial system, as its usage for testing the research hypothesis will cost you based on what resources require for how long. So without funding, it is not possible to test on a real cloud.

To address this problem Dr, Raj Kumar Buyya and his team worked presented the cloudsim which basically supports the modeling and simulation of large-scale Cloud computing data centers. This tool is basically an API developed using a java programming language.

The interesting point of this tool is that the various components of this real-world virtualization were modeled in the form of java classes and during the simulation, these classes produce similar behavior using the logical and mathematical models.

Let’s take an example of AWS EC2 instance “t4g.micro” the configuration that it defines is vCPU 2 with consistent baseline compute availability of 10%, 1 GB RAM, up to 10 GB of EBS, and up to 5 Gbps of network bandwidth.

Just like above the virtual machine configuration can be defined using a few lines of java code. The Virtual machine model behavior is implemented in Vm.java class. This class defines all the attributes like processing elements, RAM, Storage Size, Bandwidth, computation capacity, etc. The following snippet demonstrates how these attributes are initialized before the simulation process.

// VM description
int vmid = 0;
int mips = 1000;
long size = 10000; // image size (MB)
int ram = 512; // vm memory (MB)
long bw = 1000;
int pesNumber = 1; // number of cpus
String vmm = "Xen"; // VMM name

// create VM
Vm vm = new Vm(vmid, brokerId, mips, pesNumber, ram, bw, size, vmm, new CloudletSchedulerTimeShared());

Here, it is important to mention that just like a real cloud, cloudsim supports the allocation of more than one CPU to Vm through the attribute pesNumber. But the allocation is only possible if the underlined simulating host has enough resources to support the requested resources.

Now in the real-world cloud-based system, every virtual machine contains an execution environment to accommodate the application processing, where the number of processes run on this abstract virtual machine and based on the execution of these process the output/ response is either displayed to the user or sent back to the requesting entity. These process executions are intern managed through schedulers like Round-robin/ shortest job first etc.

On a similar note to support the simulation of virtualization in the cloudsim simulation toolkit, there exist four classes CloudletScheduler.java, CloudletSchedulerTimeshared.java, CloudletSchedulerSpaceShared.java, CloudletSchedulerDynamicWorkload.java.

These class models facilitate the cloudsim simulation engine to imitate the real-life scheduling process and are by far the state of the art.

The real cloud-based virtual machine allocation engine takes care of allocating the create a virtual machine to a suitable host, similarly, the cloudsim virtualization simulation engine has a model implementation in VmAllocationPolicy.java and VmAllocationPolicySimple.java. These classes are used by the datacenter class to find the right mapping of VM to Host. This task of mapping is performed through the processVmCreate() method of Datacenter.java class the logic is as follows:

protected void processVmCreate(SimEvent ev, boolean ack) {
		Vm vm = (Vm) ev.getData();

boolean result = getVmAllocationPolicy().allocateHostForVm(vm);

if (ack) {
	int[] data = new int[3];
	data[0] = getId();
	data[1] = vm.getId();

	if (result) {
		data[2] = CloudSimTags.TRUE;
	} else {
		data[2] = CloudSimTags.FALSE;
		}
	send(vm.getUserId(), CloudSim.getMinTimeBetweenEvents(), CloudSimTags.VM_CREATE_ACK, data);

	}

	if (result) {
		getVmList().add(vm);
		if (vm.isBeingInstantiated()) {
			vm.setBeingInstantiated(false);
			}

		vm.updateVmProcessing(CloudSim.clock(), getVmAllocationPolicy().getHost(vm).getVmScheduler()
					.getAllocatedMipsForVm(vm));
	}

}

Also, we know the real cloud-based virtual machines are just an abstract machine it requires a host to fulfill its resource request. Also, a single host may manage more than one virtual machine. So to support the scheduling of Virtual machine there exist a VM Scheduler policy.

To support the same in simulation, the cloudsim simulation toolkit implements a VmScheduler.java, VmSchedulerTimeshare.java, VmSchedulerspaceShared.java, and VmSchedulerTimesharedoversubscription.java. These VmScheduler classes are called every time the VM processing is updated means that whenever the cloudsim simulation engine is progressing the cloudlet/task processing intern updates the VM processing using the updateVmsProcessing() method available in Host.java class.

So every individual action that is required to be performed by the virtual machine manager is modeled within the cloudsim simulation toolkit and this allows the cloud computing researcher to test all the possible hypothesis and benchmark it on a state of the art tool.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *