Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Virtual memory and BW oversubscription implementation: when a Cloudlet requests more RAM or BW than there is available, its execution should be delayed #170

Closed
manoelcampos opened this issue Mar 26, 2019 · 3 comments · Fixed by #312
Assignees
Labels
enhancement good-first-issue A good issue to start contributing to the project resource-utilization Features related to the utilization of resources by a Host, VM or Cloudlet

Comments

@manoelcampos
Copy link
Collaborator

manoelcampos commented Mar 26, 2019

An UtilizationModel defines how a Cloudlet will use Vm's RAM. When a Cloudlet requests more RAM than the Vm has available at the moment, it's shown a warning message, but the Cloudlet execution finishes at the expected time.

WARN: CloudletSchedulerTimeShared: Cloudlet 12 requested 1000 MB of Bandwidth but no amount is available.

Virtual Memory

In operating systems, when this situation happens, the OS uses virtual memory to swap data belonging to idle processes from the RAM to the disk. This opens up RAM space for the requesting application. However, since the disk is a very slow device compared to RAM, this swapping process will slow down application execution, since the app will have to wait for the SO to perform this process and then allocate the requested memory.

CloudSim Plus has classes such as HarddriveStorage that simulates an HD/SSD and enables defining some parameters, namely: transfer rate, seek time and latency time. Using such devices from a Host, we could delay the execution of the Cloudlet when it requests more RAM than there is available.

This way, instead of just printing a warning message informing that there isn't enough RAM, we could print a message informing that virtual memory will be used and delay Cloudlet's execution.

If the cloudlet also requires a given amount of BW which isn't available, just the available amount is allocated, but that should delay the cloudlet processing too.
For instance, if the required bandwidth is 10mbps, that means the cloudlet is willing to transfer 10 mbits in one second. If just 8 mbps is allocated to the cloudlet, to transfer the same 10 mbits it will take 0,25 second more.

BW oversubscription

Concerning BW allocation, when a Cloudlets requests more BW than there is available, only the capacity available will be allocated, which must slow down cloudlet data transfer and consequently, increase cloudlet finish time. Consider the following table with sample data:

required bw (mbps) allocated bw additional delay total tranfer time
10 10 0 1
10 8 0,25 1,25

The additional delay should be computed as required/allocated - 1 and the total transfer time as 1 + additional delay.

A brief explanation of why you think this feature is useful

This will enable more accurate and realistic simulations.

References

Examples

@manoelcampos manoelcampos added the resource-utilization Features related to the utilization of resources by a Host, VM or Cloudlet label Apr 5, 2019
@manoelcampos manoelcampos added the good-first-issue A good issue to start contributing to the project label Jun 25, 2019
@Lzm1996
Copy link

Lzm1996 commented Apr 8, 2020

hello, I hope that when the task does not have enough resources, it will stop and wait for the resources to be released like the PES.
How should I implement this function

@manoelcampos
Copy link
Collaborator Author

manoelcampos commented Apr 9, 2020

Usually, you can't stop an app due to lack of RAM if you have virtual memory enabled, which all regular operating systems have. Unless your app is requesting a huge amount of memory, it must not stop. If the app starts to use virtual memory (disk), that one is much slower than primary memory (RAM). That is why apps should be delayed in such situations.

manoelcampos added a commit that referenced this issue Jun 15, 2021
Redesign Host storage to use an actual HarddriveStorage
instead of just a Storage (which is now called SimpleStorage).
This way, we can define disk parameters such as reading speed
that is considered when virtual memory is required
by Cloudlets running inside a VM on the Host.

The FileStorage interface implemented by HarddriveStorage
is now simpler, since we don't want to simulate individual file storage
for hard drive, only for SanStorage.

Adds new Host constructor to accept a HarddriveStorage instead of a long
for defining the storage device.

Since VM and Host have different storage devices now
(SimpleStorage and HarddriveStorage, respectively),
the AbstractMachine interface now is generic,
to indicate the kind of storage to be used by
subclasses.

Signed-off-by: Manoel Campos <manoelcampos@gmail.com>
manoelcampos added a commit that referenced this issue Jun 15, 2021
to check the processing delay caused by the use of Virtual Memory
after closing #170

Signed-off-by: Manoel Campos <manoelcampos@gmail.com>
manoelcampos added a commit that referenced this issue Jun 15, 2021
- Introduces cloudlet processing delay when a cloudlet
  requires more RAM than there is freely available.
- As a simplification, there is no pre-defined swap partition to define
  the maximum amount of virtual memory to use.
  The virtual memory required just needs to be smaller than the
  RAM capacity.
- Updates used VM resources for each processed cloudlet,
  instead of iterating over the cloudlets execution list
  at the end of the updateProcessing method.
  This improves simulation performance and accuracy,
  since for each processed cloudlet, VM resource utilization
  is updated right-away.

Signed-off-by: Manoel Campos <manoelcampos@gmail.com>
@manoelcampos manoelcampos changed the title When a Cloudlet requests more RAM than there is available, its execution should be delayed When a Cloudlet requests more RAM or BW than there is available, its execution should be delayed Jun 15, 2021
@manoelcampos manoelcampos self-assigned this Jun 16, 2021
@manoelcampos
Copy link
Collaborator Author

manoelcampos commented Jun 16, 2021

Finished implementation in PR #312. Check available example in the issue description above.

manoelcampos added a commit that referenced this issue Jun 16, 2021
Signed-off-by: Manoel Campos <manoelcampos@gmail.com>
manoelcampos added a commit that referenced this issue Aug 4, 2021
Redesign Host storage to use an actual HarddriveStorage
instead of just a Storage (which is now called SimpleStorage).
This way, we can define disk parameters such as reading speed
that is considered when virtual memory is required
by Cloudlets running inside a VM on the Host.

The FileStorage interface implemented by HarddriveStorage
is now simpler, since we don't want to simulate individual file storage
for hard drive, only for SanStorage.

Adds new Host constructor to accept a HarddriveStorage instead of a long
for defining the storage device.

Since VM and Host have different storage devices now
(SimpleStorage and HarddriveStorage, respectively),
the AbstractMachine interface now is generic,
to indicate the kind of storage to be used by
subclasses.

Signed-off-by: Manoel Campos <manoelcampos@gmail.com>
manoelcampos added a commit that referenced this issue Aug 4, 2021
Signed-off-by: Manoel Campos <manoelcampos@gmail.com>
@manoelcampos manoelcampos changed the title When a Cloudlet requests more RAM or BW than there is available, its execution should be delayed Virtual memory and BW oversubscription implementation: when a Cloudlet requests more RAM or BW than there is available, its execution should be delayed Nov 11, 2021
manoelcampos added a commit that referenced this issue Nov 11, 2021
After implementing virtual memory and BW over-subscription (#170),
if a Cloudlet request more RAM or BW than there is available,
its execution is delayed.

Since the example was making all cloudlets inside a VM to request 100% of RAM and BW,
some of them won't get any RAM or BW to execute, causing wrong execution times.
In such a case, a different UtilizationModel such as the UtilizationModelDynamic
should be created for RAM and BW, indicating that concurrent cloudlets
will use only a fraction of those resources.

Signed-off-by: Manoel Campos <manoelcampos@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement good-first-issue A good issue to start contributing to the project resource-utilization Features related to the utilization of resources by a Host, VM or Cloudlet
Projects
None yet
2 participants