CloudSim is a simulation toolkit for cloud environments, which allows modelling cloud computing infrastructures with various application loads, configurations, etc. CloudSim is a community driven project initially developed by the Cloud Computing and Distributed Systems (CLOUDS) Laboratory, University of Melbourne and under the GPL license.
Being an extensible framework, the CloudSim toolkit allows researches to add modifications to cloud data centres similar to new resource provisioning algorithms, and then simulate how the cloud infrastructure would handle a given workload with the new modifications. The data gathered from this simulation is then used for the analysis. In this manner, researchers do not have to worry about implementing the simulation engine, or configuring an actual cloud infrastructure even at the initial stages of the research.
The article https://www.cloudsimtutorials.online/cloudsim-setup-using-eclipse/ explains how to configure CloudSim and run an example simulation using the Eclipse. In this article, I will explain how to do the same with the popular IDE, IntelliJ IDEA.
Configure and execute with IntelliJ IDEA
- Extract the CloudSim artifact. This is a zip file for windows, and a tar file for mac and linux.
- Open extracted project folder with IntelliJ.
3. We need to add the apache commons dependency to the project. To do that, go to File -> Project Structure and open the Libraries tab. Click the Plus(+) icon and add the apache commons jar file. Click Ok to apply and close the window.
4. CloudSim needs to run with Java 7. Therefore lets configure the project to use JRE 7. First configure JRE 7 in your computer. I usually download JRE tar archive and point that in the IntelliJ. To do this, open File -> Project Structure and open the Project panel. In the Project SDK section, make sure it is pointed to the JRE. And also, make sure that the Project Language level is set to JAVA 7.
5. At this point, the CloudSim toolkit is ready to be executed. There are several examples packed with the project which demonstrate how to use the toolkit. These are great examples to learn the toolkit usages. Let’s execute one of them to verify the IDE configurations. But first we need to let the IntelliJ know that these examples are Java source files that can be executed as Java applications. Therefore, right click on the examples folder and navigate -> Mark Directory as -> Sources Root.
6. Now all the steps are completed. Let’s execute the first example and see what happens. Navigate to examples -> org.cloudbus.cloudsim.examples -> CloudSimExample1. Then Click on the Green arrow right next to the class name and click Run ‘CloudSimExample1.main()’. This will start executing the sample.
7. If everything goes fine, you will see the successful execution log.
If you encounter an error, carefully investigate what is the root cause. Usually it should be a configuration issue with JRE 7 or the external apache commons dependency.
Now you can create your own source files on top of the CloudSim toolkit and execute in the same manner with IntelliJ IDEA.
Please refer to this great article series for additional information about the CloudSim framework.
In the begining we understood that the CloudSim is a toolkit that can be utilized for experimenting with cloud infrastructures. Then we downloaded the CloudSim project and configured it with IntelliJ IDEA. Finally, we executed one of the out of the box examples shipped with the project and understood that the toolkit can also be utilized with custom scenarios in the same manner.
That concludes this article. Let me know what you think in the comment section below.
Until we meet again in a future blog, Cheers!