Deliberately slow down file access speed

1

1

I am trying to deliberately slow down access to files on my Windows machine to test load times on an application I am making.

I've tried virtual machines and giving it limited CPU/RAM resources, but that doesn't quite do what I require.

Is there a way to slow down access to the virtual hard drive or to a folder etc?

VirtualBox/VMWare are both good.

Anton8000

Posted 2016-05-23T12:35:45.090

Reputation: 1 274

Answers

2

For VirtualBox,

Starting from version 4.0 we are able to limit Virtual Box bandwith for acess to disk images (see Virtual Box Manual for details)

We need to create a bandwith group first (in the example below named "Limit" for 20 MB/s):

VBoxManage bandwidthctl "VM name" --name Limit --add disk --limit 20
VBoxManage storageattach "VM name" --storagectl "SATA" --port 0 --device 0 --type hdd
                                   --medium disk1.vdi --bandwidthgroup Limit
VBoxManage storageattach "VM name" --storagectl "SATA" --port 1 --device 0 --type hdd
                                   --medium disk2.vdi --bandwidthgroup Limit

Note: From versions >= 4.2 these commands changed to:

VBoxManage bandwidthctl "VM name" add Limit --type disk --limit 20M
VBoxManage storageattach "VM name" --controller "SATA" --port 0 --device 0 --type hdd
                                   --medium disk1.vdi --bandwidthgroup Limit
VBoxManage storageattach "VM name" --controller "SATA" --port 1 --device 0 --type hdd
                                   --medium disk2.vdi --bandwidthgroup Limit

We need to give the details of our personal setup above.

To further limit disk access to 10 MB/s we can then issue

VBoxManage bandwidthctl "VM name" --name Limit --limit 10 # version 4.0
VBoxManage bandwidthctl "VM name" set Limit --limit 10M   # >= 4.2

This can even be done during runtime.

Please note that all credit is due to the original author on Ask Ubuntu.

You'reAGitForNotUsingGit

Posted 2016-05-23T12:35:45.090

Reputation: 614