The power and time cost is not considered, when powering a host on/off
jmsw4bn opened this issue · comments
ISSUE
When I change the active state of a host.
Actual behavior
No extra power and time cost is spent.
Expected behavior
Actually, extra power and time cost is needed to power on/off a host, and a host cannot directly change from an active state to off state (and vice versa).
I scrutinize the source code, and find that, when setting a host active, the host is active immediately.
Accordingly to the actual situations, it will take tens of seconds to power a host on/off, and during such time extra power is consumed.
Therefore, I suggest to fix this problem to support accurate power-aware simulations.
Available Examples
Related Issues
Hello @jmsw4bn
Thanks for reporting this issue. You're right. This is a feature inherited from CloudSim. Despite lots of bugs were fixed and new features included, Host's boot and shutdown processes are simplistic and don't consider the time and power consumption.
But unfortunately, I won't be able to implement this feature in the short term.
I hope to get some help from the community to implement that.
If you're willing to do that and need some support, just let me know.
I had used cloudSim in the past. And I would like to work on this feature.
That is great. I think we could start by modeling the proposed solution. Do you have something in mind already?
Currently I don't have a clear idea. I will start reading papers and information regarding
- what all actions get run while starting and stopping the host
- time required for all of these actions
- if required we can simulate these actions too
The operations performed during startup and shutdown will vary depending on the host OS. Since we don't simulate OS specific features, we should follow a simpler approach.
The startup up and shutdown time will vary according to the host capacity (CPU cores and MIPS). Host load will impact that too.
If there are some papers related to that, it would be great.
Anyway, we should create some interface and classes to model these behaviors, such as the ones that model power consumption (see PowerModelHost).
This way, an initial class diagram would be great.
Currently I am reading papers regarding that.
Great, if you find some paper that is useful, please provide the DOI link here.
Unfortunately there are not many papers regarding the issue. I am studying the PowerModelHost
Instead of adding new interface and classes, I am thinking of adding simple methods to simulate power consumption during power on/off in PowerModelHost.java. Because power consumption during power on/off should come under PowerModel. Also, introduce delay during power on/off in setActive in Host.java
That seems to be the way to go. Let me know if you need any help. Thanks.
What should be the number of instructions required for booting up/down the host? Depending upon that we can calculate the time required to finish boot up/down.
Time = (No. of Instructions for boot up/down in Million) ÷ (MIPS of Host)
Also please tell me how to introduce a delay in simulation(which function to call)?
What should be the number of instructions required for booting up/down the host? Depending upon that we can calculate the time required to finish boot up/down.
Time = (No. of Instructions for boot up/down in Million) ÷ (MIPS of Host)
I'm not an OS expert, but this is totally dependent on the OS and version being used and the underlying hardware. Regarding that, I'm afraid there is no way we could accurately compute the number of instructions required to determine boot time. If we consider different hardware architectures, multiple linux distributions and the countless number of kernel versions, it's unfeasible to determine an equation to compute MI number.
A simple solution to simulate boot/shutdown time may be just PowerModelHost
attributes to determine the delay (in seconds) for those tasks. One would argue that boot/shutdown time is not always the same. But for simulation purposes, a static value may be good enough. If you have heterogenous hosts, you can use PowerModelHosts
with different configurations.
Also please tell me how to introduce a delay in simulation(which function to call)?
There are lots of different ways to send a message, depending in which class you are and what you are trying to do.
Check the CloudSim.send()
, CloudSimEntity.send()
and CloudSimEntity.schedule()
methods. There are lots of overloaded versions of them. Just use the one that fits you and has the least number of parameters. Usually, there is a delay
parameter (that is what you're looking for).
Don't ask me why there is a send
and a schedule
methods that do the same thing 🤣. This is just inherited from CloudSim. Those methods are used everywhere and I didn't want to touch them.
I have added a delay call (using simulation.send()) for 10 seconds(for testing), but the 10 seconds are considered after all the simulation is done, not when host powers on/off. I am confused what to do.
See this call before return statement in HostSimple.java > setActive(bool activate);
public final Host setActive(final boolean activate) {
if(isFailed() && activate){
throw new IllegalStateException("The Host is failed and cannot be activated.");
}
final boolean wasActive = this.active;
if(activate && !this.active) {
setStartTime(getSimulation().clock());
} else if(!activate && this.active){
setShutdownTime(getSimulation().clock());
}
this.active = activate;
notifyStartupOrShutdown(activate, wasActive);
this.getSimulation().send(datacenter, datacenter, 10, CloudSimTags.HOST_POWER_ON_OFF, datacenter);
return this;
}
CloudSimTags.HOST_POWER_ON_OFF is added by me.
See output of HostActivationExample.java;
1.txt : (without delay)
2.txt : (with delay)
Send a PR and we can start looking at the code and proposing changes.
Add me to the repository. I need to push my branch in order to create a Pull Request.
There is no need for that. If you have a fork of the repository, you can freely send a Pull Request. If you haven't created the fork yet, follow these steps:
- fork CloudSim Plus repository
- clone it into a directory different than the one you already made the changes
- copy changed files to the new directory
- push the changes in this new directory and open a PR
I have made a pull request