Hi,
I'm using vbox to develop some software within the guest system (winXP). The development files will only take up 200 MB of space within the guest.
Now I'm looking for some ways to improve performance. I'm not sure about file cache within Mac (snow leopard). Is it useful to split the WinXP image into two disks, one of them a ram-disk of the Mac hosts (here I would store the development files, *.c and *.h, lib's and so on)? The ramdisk will also store the temporary development and debugging files. Or is Mac file cache already "good enough", and the disk image of WinXP (size 16 GB) will be fast enough 'cause of the file cache?
Thanx for any suggestions
Peter
optimizing vbox with Mac ramdisk
-
stepmuel
- Posts: 6
- Joined: 17. May 2010, 02:15
- Primary OS: Mac OS X other
- VBox Version: VirtualBox+Oracle ExtPack
- Guest OSses: Ubuntu, Windows
Re: optimizing vbox with Mac ramdisk
Are you sure the hd access is really your bottleneck? I used to put my files into a shared folder so I could edit them in TextMate and only used the VM to compile; worked pretty well.
Back to your question: It is possible to use a raw drive within Virtualbox. (See here or search the manual for "raw host hard disk".) You can for example choose a partition on your local hard disk for the vm: "VBoxManage internalcommands createrawvmdk -filename rawdisk.vmdk -rawdisk /dev/disk3s3". Use the info button in disk utility to get the correct disk name. To use the whole disk, just leave the "s3" part. Please note however that the disk names may change (especially for removable media) which may lead to bad results…
There are ways to create ramdisks that can be accessed the same way described above… But I don't think the performance gain is worth the risk (accidentally erasing external hard disks etc.). I would rather add more RAM to the virtual machine and look for a way to create a ram drive within windows.
If you use raw disks as described above, the disk access gets buffered in windows and again from Mac OS X. To disable buffering on the host side, you may use "/dev/rdiskX" (not tested).
Back to your question: It is possible to use a raw drive within Virtualbox. (See here or search the manual for "raw host hard disk".) You can for example choose a partition on your local hard disk for the vm: "VBoxManage internalcommands createrawvmdk -filename rawdisk.vmdk -rawdisk /dev/disk3s3". Use the info button in disk utility to get the correct disk name. To use the whole disk, just leave the "s3" part. Please note however that the disk names may change (especially for removable media) which may lead to bad results…
There are ways to create ramdisks that can be accessed the same way described above… But I don't think the performance gain is worth the risk (accidentally erasing external hard disks etc.). I would rather add more RAM to the virtual machine and look for a way to create a ram drive within windows.
If you use raw disks as described above, the disk access gets buffered in windows and again from Mac OS X. To disable buffering on the host side, you may use "/dev/rdiskX" (not tested).
-
stepmuel
- Posts: 6
- Joined: 17. May 2010, 02:15
- Primary OS: Mac OS X other
- VBox Version: VirtualBox+Oracle ExtPack
- Guest OSses: Ubuntu, Windows
Re: optimizing vbox with Mac ramdisk
The shared folder approach may be fast because the host system can actually cache the individual files… You may also share a folder on a Mac OS X RAM disk. Raid 0 or the use of a fast external Harddrive (maybe even a fast memory stick) may also improve performance (especially if your working on a laptop). Please let me now what works best for you so I know what to do when I have to compile stuff under windows again myself.
-
p.prinzen
- Posts: 4
- Joined: 18. May 2010, 12:04
- Primary OS: Mac OS X Leopard
- VBox Version: VirtualBox+Oracle ExtPack
- Guest OSses: windows xp
Re: optimizing vbox with Mac ramdisk
HI,
I just made some tests, using HDD Speed Test v.1.0.14 (a windows prog)
Using vbox-windows disk "c": write 1.2 MByte, read 7.5 MByte
mac ramdisk (macperformanceguide.com): write 2 MByte, read 12 MByte
windows Ramdisk (Trialversion Superspeed Ramdisk plus): write 4.7 MByte, read 15 MByte
Is the "c"-speed "normal", I'm using the original MacBookPro Toshiba hdd? Is it perhaps more useful to speed up the MBP hdd?
Peter
I just made some tests, using HDD Speed Test v.1.0.14 (a windows prog)
Using vbox-windows disk "c": write 1.2 MByte, read 7.5 MByte
mac ramdisk (macperformanceguide.com): write 2 MByte, read 12 MByte
windows Ramdisk (Trialversion Superspeed Ramdisk plus): write 4.7 MByte, read 15 MByte
Is the "c"-speed "normal", I'm using the original MacBookPro Toshiba hdd? Is it perhaps more useful to speed up the MBP hdd?
Peter
-
p.prinzen
- Posts: 4
- Joined: 18. May 2010, 12:04
- Primary OS: Mac OS X Leopard
- VBox Version: VirtualBox+Oracle ExtPack
- Guest OSses: windows xp
Re: optimizing vbox with Mac ramdisk
Hi,
some further tests: when compiling my files of the vbox hdd, it takes 90 seconds, when compiling using the windows ramdisk, it's only 12 seconds.
Peter
some further tests: when compiling my files of the vbox hdd, it takes 90 seconds, when compiling using the windows ramdisk, it's only 12 seconds.
Peter
-
stepmuel
- Posts: 6
- Joined: 17. May 2010, 02:15
- Primary OS: Mac OS X other
- VBox Version: VirtualBox+Oracle ExtPack
- Guest OSses: Ubuntu, Windows
Re: optimizing vbox with Mac ramdisk
Sounds impressing. Do you have some links on how to create a ramdisk in windows?p.prinzen wrote:when compiling my files of the vbox hdd, it takes 90 seconds, when compiling using the windows ramdisk, it's only 12 seconds.
Did you attach the mac ramdisk using the raw feature? How big was the ramdisk? Was there enough free RAM available? Did you also try shared folders? I'm not surprised the ramdisk on windows side performs best, but I'm still curious
The slow harddisk may allow further optimizations, since it still holds all the executables and probably additional libraries. You could try to install windows on either a fixed size image or on a raw partition on your laptop (or faster external harddrive). A additional Partition on the laptops harddisk can be created by shrinking the root partition. As for the source files, I think the windows ramdisk is probably already the optimal solution. You could also try using a fast expresscard ssd; although amazon reviews indicate they are not that reliable.
-
p.prinzen
- Posts: 4
- Joined: 18. May 2010, 12:04
- Primary OS: Mac OS X Leopard
- VBox Version: VirtualBox+Oracle ExtPack
- Guest OSses: windows xp
Re: optimizing vbox with Mac ramdisk
I used http://www.superspeed.com/desktop/ramdisk.php, perhaps will try "Gavotte Ramdisk"stepmuel wrote:Sounds impressing. Do you have some links on how to create a ramdisk in windows?
I used a mac ramdisk with a tool of http://macperformanceguide.com/Mac-HowT ... MDisk.html, with size 1GB. I have to try shared folders and the "raw disk feature", but no time yet.stepmuel wrote:Did you attach the mac ramdisk using the raw feature? How big was the ramdisk? Was there enough free RAM available? Did you also try shared folders? I'm not surprised the ramdisk on windows side performs best, but I'm still curious
I'm currently curious, should I upgrade the hdd or RAM... I gues I will get most benefit out of more ram, allowing windows to create/use a bigger ramdisk.stepmuel wrote:The slow harddisk may allow further optimizations, ...
BTW: my MacBookPro currently has 4 GB RAM, VBox got 2 GB RAM (or, with ramdisk within windows, 2.5 GB RAM).
-
stepmuel
- Posts: 6
- Joined: 17. May 2010, 02:15
- Primary OS: Mac OS X other
- VBox Version: VirtualBox+Oracle ExtPack
- Guest OSses: Ubuntu, Windows
Re: optimizing vbox with Mac ramdisk
I just made some additional measurements… Rawdisk doesn't seem to improve disk performance neither using /dev/disk0s3 nor /dev/rdisk0s3. Booting windows in both ways took about 50 seconds; using a usual vdi file (created with VBoxManage convertfromraw) only about 45. Results may vary using a whole disk (e.g. /dev/rdisk1). An additional note: createrawvmdk can't be used to create a vmdk file directly from a /dev/rdisk file; however, it can be created via /dev/disk and changed to /dev/rdisk with a text editor later.
Before buying a new internal harddisk, I would recommend to use the disk image from an fast external harddisk; just to check how much the improvement possibly can get. Also, more ram wont help if its usage doesn't reach any limits and therefore is not the actual bottleneck (on client or host side). If CPU usage reaches its limit, I suppose neither will help.
Before buying a new internal harddisk, I would recommend to use the disk image from an fast external harddisk; just to check how much the improvement possibly can get. Also, more ram wont help if its usage doesn't reach any limits and therefore is not the actual bottleneck (on client or host side). If CPU usage reaches its limit, I suppose neither will help.
-
Uzume
- Posts: 90
- Joined: 9. Sep 2009, 21:10
- Primary OS: MS Windows XP
- VBox Version: VirtualBox+Oracle ExtPack
- Guest OSses: MS Windows 2003, PureDarwin
Re: optimizing vbox with Mac ramdisk
You might run into size limitations at some point. I know there is a max RAM size to the VM (some people have been trying to hack around this in OSE but evidently the problems is not as trivial as first imagined). You could try more RAM and then make a host RAM disk and try shared folders or raw access. I have not done any measurements but personally methinks your best bet might be to upgrade your HDD to something like an SSD. That would also speed up your host considerably as well. When you can jack the secondary storage speed up to come close to memory access speeds the amount of memory you have is much less important as paging is not much of a hit.p.prinzen wrote:I'm currently curious, should I upgrade the hdd or RAM... I gues I will get most benefit out of more ram, allowing windows to create/use a bigger ramdisk.stepmuel wrote:The slow harddisk may allow further optimizations, ...
BTW: my MacBookPro currently has 4 GB RAM, VBox got 2 GB RAM (or, with ramdisk within windows, 2.5 GB RAM).