cloudsimplus / cloudsimplus

State-of-the-art Framework 🏗 for Cloud Computing ⛅️ Simulation: a modern, full-featured, easier-to-use, highly extensible 🧩, faster 🚀 and more accurate ☕️ Java 17+ tool for cloud computing research 🎓. Examples: https://github.com/cloudsimplus/cloudsimplus-examples

Home Page:https://cloudsimplus.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Task execution time calculation

JerryLeibniz opened this issue · comments

ISSUE:

Execution time calculation error when setting different number of CPUs for cloudlet in basic use case

Actual behavior

When the number of CPUs I allocate to a task exceeds the number of virtual machine CPUs, the task execution time will exceed the normal number of CPUs. For example, I have allocated 5 CPUs to the task, and its execution time is 12.5s, but if I give it Allocating 4 CPUs, its execution time is 10s.
In addition, I think there is a problem with the calculation logic of the execution time. It does not consider how to calculate when a task is allocated to multiple CPUs. In the test, I found that the execution time of allocating 2 CPUs and 4 CPUs is the same. This is obviously wrong.

The scheduling strategy I use here is CloudletSchedulerSpaceShared

Expected behavior

Normally, if the number of CPUs required for a task exceeds the number of CPUs of the virtual machine, it should not be allocated successfully, and the execution time should also be related to the number of allocated CPUs.

If it is a wider problem or you don't know where it happens, please provide a minimal simulation example which reproduces the problem

image

Hey @JerryLeibniz,
please download the latest sources and check if the issue was fixed.
A similar issue #462 has just been fixed.

If you have changed the BasicFirstExample, please provide the source code, not a screenshot.

Download the sources and execute mvn install to use the latest version in you examples project.

In addition, I think there is a problem with the calculation logic of the execution time. It does not consider how to calculate when a task is allocated to multiple CPUs. In the test, I found that the execution time of allocating 2 CPUs and 4 CPUs is the same. This is obviously wrong.

That depends on what you want to simulate. If you consider a web server that is responding requests concurrently, more CPUs just indicates more users can be served at the same time. If we have 2 CPUs and we are serving 2 users, adding 2 more CPUs doesn't make the requests for these 2 users run faster.

Consider you have a CPU-intensive task instead of this web server example. If you split a task into multiple CPUs (by splitting the task to process a subset of the data), you might reduce the total execution time (if the task complexity and/or data volume is large enough). The only way I see to simulate such a scenario (to reduce task completion time by increasing the number of CPUs) is reducing the cloudlet length. If you have a Cloudlet with 10000 MI, it's expected to finish in 10 seconds in a 1000 MIPS CPU. If your Cloudlet has just 1 CPU, such a CPU will run those 10000 MI. If you have 2 CPUs, each one will execute 1000 MI, representing a total of 2000 MI executed. Considering that your Cloudlet has just 1 CPU and you want to simulate the reduction in task processing time, you can double the number of CPUs but halving the length of the Cloudlet. This way, each CPU will execute just 5000 MI (10000 at total). Therefore, each "task" simulated in each CPU will take just 5 seconds to finish (running in parallel).

Additionally, this is the way that it works since CloudSim. Maybe the more obvious way to execute the cloudlet instructions is as follows. If we have a Cloudlet with 10000 MI length using 1 CPU, if we add 1 more CPU, each CPU would execute 5000, halving the Cloudlet execution time.

But that is not true for the web server scenario I mentioned. Therefore. You just need to understand the way the tool works and adapt your scenario to your needs as explained.

Therefore, I don't see an issue here because this is the way it work and you can meet different scenarios needs adjusting your simulations. I'm closing the issue but if you have other thoughts, feel free to reopen and reply.