Jump to content
Mike Torrettinni

Using Delphi in Virtual machine for a month

Recommended Posts

Maybe this will help someone deciding on trying to use Delphi in VM:

 

I used Delphi 10.2.3 in VMware for a month and I just reinstalled it back on my local machine, it just didn't really work for me in VM.

 

So, specification:

 

Desktop: Intel I7 4790K (4c/8t), 32 GB Ram and all SSDs; Windows 10.

VMWare Workstation Pro 15.1 installed on local PC - I researched quite a lot on how to improve experience with VM

Settings:

  Memory: 12GB

  Processors: 4 (processors: 2, cores per processor: 2)

  VM file is on separate SSD.

 

Fresh Windows 10 installed in VM (+all updates + all latest drivers)

To make it run a fast as possible (or to limit resources used) I disabled all non-essential services, cleaned up startup programs, no antivirus or antimalware installed.

Very few other tools, just 7z, WinRar...

 

Delphi 10.2.3 + IDEFixPack + MMX + GExperts + CNPack

Disabled Start page + disabled Live binding.

 

One of the reasons why I tried Delphi in VM is to have simple backup and grab-and-go Delphi environment.

So, at first it seemed to work well, full build time was a bit slower, but not too annoying - 50% longer than compile time on local. A bit slower IDE, slower switching between Form and code.

For the testing of concept it was acceptable and luckily at that time I didn't have any real development time scheduled, just some minor bug fixes.

 

But as soon as I started really working with it, all these little things became very annoying, in a matter of few hours:

- delays in mouse right-click in code to use Toggle Breakpoints or Refactor (rename variable)

- delay on selecting Form controls and Object inspector to populate properties and Structure view

- opening menus

- even ctrl+home/end on large unit (40K loc ) was delayed

- and other little delays here and there

 

The delay I'm talking about is very minor, probably less or close to 1s, but when you use IDE a lot these delays become very apparent and annoying. For me this was too much after a few hours of real work.

 

To summarize, I think I optimized VM as much as I could to run as fast as possible; the computer is still powerful enough even though is not brand new high-end computer; I don't have huge projects, but they do have some 100Ks loc each.

If I would install all the rest of the tools I use in my daily development environment and run them as I do on local computer (memory regularly gets used 20GB+) it would slow down the whole VM experience even more.

 

I doubt that VirtualBox or any server virtualization (Hyper-V?) would improve the experience.

 

Maybe it's my patience (or the lack of it) that got tested really fast, but VM just isn't working for me.

 

If anybody has different experience, please let me know if you have any advice on how to make the whole experience better - smoother IDE, like on local installation where runs really fast (very acceptable).

 

 

  • Like 2
  • Thanks 1

Share this post


Link to post

We have been using Delphi in a VMWare Workstation for over a decade. We have a team of about 12 people. Some remote workers use Delphi in a Citrix instance run on our XenDesktop environment.

A decade ago, there were lots of problems.  Windows activation issues. Delphi activation issues. etc. But we stuck with it because it ensured all team members have an identical instance set up appropriately. Also, if one computer crapped out, we were up and running within 20 minutes.

These days, its a no brainer. We dont even have Delphi installed directly on the host machines any longer, so I cannot compare to a host installation on the same machine, but running in the VM is more than acceptable.

All benchmarks we have run (i.e. running same executable inside vm and on real machine) are within 95% speed of each other. For profiling, we dont even both copying to the host machine any longer, unless we are profiling heavy multi-threaded work.

What does make a big difference is to put the VM on an SSD. Compile times are much faster.

Our App is about 2 million LOC, but we ensure that our individual units are not too large. Usually a few K LOC, up to a max of 20K LOC or so.

 

CTRL+END is pretty instant for me, even in the largest units.

Maybe we would get 1/2 sec better on some mouse actions if we installed it on the desktop, who knows, but I personally do not notice any speed impediment due the to the VM. My typing speed is usually the bottleneck, not the IDE (and I type pretty fast).

 

Edited by Dave Novo
  • Like 3

Share this post


Link to post

I use Delphi in VMWare for nearly 5 years. In general, I am very happy with the speed but TBH I haven't used it in natural machine. I've got packages, tools, libraries VS, Android Studio all in one machine and I am able to work nicely. 

 

From my experience, what matters when you run a VM is the setup of the VM of course but also what is happening in the host computer. 

  • Memory: the more allocated to the VM the better but not more than that...there is a point where your host will start crawling and the VM will become sluggish if the host does not have enough memory
  • SSD and avail space: SSD for obvious reasons and AVAIL SPACE...from what I have seen, you need lots of space with VMWare. I mean for a VM that has a 200GB hard drive, you may need 300GB in the host computer and maybe more if you keep auto protect and other snapshots. Even deleting snapshots you need 20-40GB free on your host drive
  • Restating the host computer: I've noticed that many times, VMWare does not clean and release the previously used space to the host computer. You may, for example, have 20GB avail after deleting a snapshot and when you restart the host you get 45GB
  • Antivirus, Windows Update, Microsoft Store and all the other services (eg. svhost) in the host computer. This environment needs to be very pure (and mine is not)...but there are limits even to the level of this kind of purity you can achieve
  • Backup software on host: There was a time when my VMs were getting very very slow without any reason and after months I discovered that there was a backup services running in the background. It was copying the whole VM to the backup disks and this was making the VM unworkable. Later I found out that there is VMWare API for backup and some nice specialised software that allows the VM to work smoothly (eg. the free Vimalin)
  • Netflix:classic_dry:: if you have that bad habit to play a documentary in one screen while you are doing some light work in your VM in the second monitor, then you are hurting the performance of the VM. On my laptop, the Netflix app is a performance killer (regardless of the VM). Thankfully, I got rid of that bad habit

I have, also, configured windows to use the NVIDIA graphics card with VMWare instead of the integrated graphics. Not really sure whether it makes a real difference though.

And, I have completely disabled Windows Store in the VM. Actually, I have damaged the installation and I am sure it will bite me back at some point:classic_sad:

 

Don't forget, also, to run CCleaner or something similar quite often in both the host and the VMs

 

  • Like 2

Share this post


Link to post
Guest
1 hour ago, John Kouraklis said:

...and you need antivirus/firewall in your VM as well...It's high risk unless you do not access the internet at all. 

Windows 10 has a built in AV and you will see it in the AV test rankings (as any other AV software) at any position (depends on the test and the time).

Share this post


Link to post

For the same reason I abandoned using VM for Delphi, productivity is the key to me. But benefits described by Dave Novo
Dave Novo still stand. And the factors that might affect the performance listed by John Kouraklis definitely worth checking, especially anti-virus software.

 

The real-time protection of any AV software is the major, most significant culprit of performance loss, I think you should use an AV without or allow you to disable real-time protection like me :)

 

IMHO a program don't really need real-time AV protection, you should have the necessary habits to keep you safe from dark side of the Internet.

  • Like 3

Share this post


Link to post
Guest
2 minutes ago, edwinyzh said:

The real-time protection of any AV software is the major, most significant culprit of performance loss, I think you should use an AV without or allow you to disable real-time protection like me 🙂

I simply exclude my project directories from AV.

Share this post


Link to post
5 minutes ago, Schokohase said:

I simply exclude my project directories from AV.

That's not enough if I were you. No matter how many directories you exclude from AV, disabling the real-time protection can still avoid human noticeable performance difference. That's my experience with over 2 AV software a few years ago, not sure how things are going now, nowadays I use only MSE, plus virustotal if needed.

 

BTW, what's the most performant AV software nowadays? When I used ESET it's the most performant one in my experience.

  • Like 1

Share this post


Link to post

One option to consider: Instead of using the monitor/mouse/keyboard emulation of the VM, try connecting to the VM through Remote Desktop. In my experience that makes a lot of a difference.

  • Like 3

Share this post


Link to post
Guest

Thanks to all that have insights. Pile up your tips and tricks! The benefits of developing in a VM are heavy (esp. for a shop like mine).

 

I feel that my Tokyo VM is *very* sluggish. I suspect DX skinning a lot. A new problem is that sometimes when i press Alt and stop myself (releasing Alt) the IDE misaligns with the VM desktop and both the client and the host starts to refresh the desktop. Argh!

Share this post


Link to post

Scaling of the windows in a VM is not done efficiently especially if you move thw VM window from a 4K monitor to a non-4K.

 

But in general, I agree with @Dany Marmur. There are huge benefits in using VMs

  • Like 1

Share this post


Link to post

I've been using Delphi in a VM for a number of years utilizing VMWare Workstation and I believe it runs really well.  It sounds like a VMWare settings / allocation issue.

 

Couple pointers:

- Do not utilize 'thin-provisioned' disks.  Pre-allocate the assigned space otherwise you'll get sporadic speed issues as the disk increases in size.

- Exclude the directory on the host machine where your VM files are stored from realtime AV scanning.  If you cannot exclude a specific folder (like McAfee), get a different AV.

- Don't try to assign too much RAM to the VM.  Test scaling it back from 12GB to 10 and then 8.   I have 64GB RAM in the host and only allocate 8GB to my Delphi VM.

- Use SCSI virtual disks

- Display: Accelerate 3D Graphics + assign a decent amount of graphics memory  (1GB)

- The more snapshots of a VM, the worse the performance seems.  Make physical backups instead and get rid of your snapshots. 

- I periodically defragment the virtual disks within VMWare   (https://docs.vmware.com/en/VMware-Workstation-Pro/15.0/com.vmware.ws.using.doc/GUID-BD914064-D20D-4032-9373-88F4DA7AE7C6.html)

 

Some items I don't use, not sure on the performance benefit

- Don't use the built-in Shared Folders

- Don't use the built-in auto-protect

- Don't sync time with host

 

If you can swing it - use NVMe disk instead of SSD.   

 

 

  • Like 2
  • Thanks 1

Share this post


Link to post

We have used Delphi in Virtualbox for 10+ years using a separate SSD for the VM makes the biggest improvement and using the extensions help, no AV software in the VM.  We keep the source on the host drive with a share to the VM, this lets us upgrade the VM/Delphi faster, source control also lives on the host with the source directories excluded from AV monitoring.   We run multiple VM's at the same time, 2012 Server with SQL and our services for a complete isolated (virtual networks) production like environment. No need to ever access the internet from the VM's except for Windows updates.  We use i7 laptops with 32GB and multiple SSD/M.2's on docking stations with multiple monitors so the Delphi VM has it's own full screen, the 2012 server is minimized 90% of the day.     

  • Like 2

Share this post


Link to post

Thank you, great tips! Will try some and see how it goes.

 

Oh, yes, thank you for pointing it out: I don't use any AV in VM, and I excluded the VM file disk folder from anti malware sw and Defender monitoring. Same for Shared folders, excluded from monitoring.

Edited by Mike Torrettinni

Share this post


Link to post
18 hours ago, Darian Miller said:

I've been using Delphi in a VM for a number of years utilizing VMWare Workstation and I believe it runs really well.  It sounds like a VMWare settings / allocation issue.

 

Couple pointers:

- Do not utilize 'thin-provisioned' disks.  Pre-allocate the assigned space otherwise you'll get sporadic speed issues as the disk increases in size.

- Exclude the directory on the host machine where your VM files are stored from realtime AV scanning.  If you cannot exclude a specific folder (like McAfee), get a different AV.

- Don't try to assign too much RAM to the VM.  Test scaling it back from 12GB to 10 and then 8.   I have 64GB RAM in the host and only allocate 8GB to my Delphi VM.

- Use SCSI virtual disks

- Display: Accelerate 3D Graphics + assign a decent amount of graphics memory  (1GB)

- The more snapshots of a VM, the worse the performance seems.  Make physical backups instead and get rid of your snapshots. 

- I periodically defragment the virtual disks within VMWare   (https://docs.vmware.com/en/VMware-Workstation-Pro/15.0/com.vmware.ws.using.doc/GUID-BD914064-D20D-4032-9373-88F4DA7AE7C6.html)

 

Some items I don't use, not sure on the performance benefit

- Don't use the built-in Shared Folders

- Don't use the built-in auto-protect

- Don't sync time with host

 

If you can swing it - use NVMe disk instead of SSD.   

 

 

👍

 

- don't use snapshots at all (they were intended as short time snapshot anyway), I use complete duplicated images instead (about < 1 min on modern SSD)
- Keep Windows lean and clean (tidy up temporarily files and system update files regularily)

- Clean the VM image regularily

...

<to be continued>

  • Thanks 1

Share this post


Link to post
Guest
On 8/17/2019 at 5:24 PM, Tom Chamberlain said:

so the Delphi VM has it's own full screen

That may be rather important. I have noticed performance dropping and as i read along this might be that i started a new one with 10.2 and around that time bought a huge monitor. When i bought the huge one (because a 2 monitor setup was a mess with scaling in the beginning and because of my back and shoulders) i started to have two VM monitors on the same screen to be able to debug GUI-stuff better. Just a thought, speculating...

Share this post


Link to post

I have used Delphi in a VM  (VMWare Fusion) starting about 10 years ago.  I bought Fusion for my Mac Pro (an old 2.2Ghz Core2Duo).  Initially I had VMs on my laptop HD, but moved them to an external SSD drive formatted as HFS+.  I purchased Paragon's HFS+ support for Windows and shared the VM drive between my Mac Pro Laptop and my PC Desktop.  It worked pretty well, but I had to abandon it for one contract as soon as I started using the RAW Input API as that is not supported under VMWare.  I then bought an 3.0 Ghz AMD 6 core Win7 64 bit desktop and it screamed using XE2!  Still one of the fastest machines I have ever used Delphi on.

 

I used to use VMWare Fusion on my Mac Pro laptop until it died and I replaced it with a Mac Mini which is a little under powered for VMs.   Now I am using Ubuntu on my laptop (an old Toshiba Satellite L70-D) 4 core machine with 8Gb RAM, an SSD for the OS and a fast, large HD for the VirtualBox VMs.  Performance of 10.3.2 is good.  The re-drawing was painful with 10.3.1.  I am thinking about putting Ubuntu on my main desktop as well.  More cores and much more memory.  I am also no longer using VMWare, instead using VirtualBox 6 which seems pretty stable and performant.  I use the Host OS for Internet access (FireFox) and share folders from the host for code so I can switch VMs and still compile the same source.  This works well to experiment with Betas and other VM configurations, while not confusing things by having source code in each VM, potentially in a different location.  You can of course have VMs for specific clients so one Delphi configuration does not conflict with another. 

 

The only issue I have had to date is an occasional "lockup" where the VBox VM and the Ubuntu host machine have become unresponsive to the point I have had to power off my laptop.  I didn't have any data loss, and I think I narrowed this down to FireFox chewing all the RAM/CPU at some point.  Now I only have FireFox running when I need to, and have not had such a situation for a long time.  I am even considering switching to Chrome.

 

For me the flexibility of using VMs far outweighs the performance penalties.

 

  • Like 1
  • Thanks 1

Share this post


Link to post

If you use VirtualBox do not do defrags from inside the VM, use a tool like CloneVDI.  We use this once a month to compact and optimize the VDI files before making backups of the VMs.

  • Like 1
  • Thanks 1

Share this post


Link to post

Been using Delphi in a Parallels VM on a Mac for four years now. Now problems, no worries, no special settings. Only iOS compiles need to be done twice, because the compiler or the linker or whatever only likes the shared folders every other turn...

  • Like 1

Share this post


Link to post
On 8/18/2019 at 5:28 PM, Dany Marmur said:

That may be rather important. I have noticed performance dropping and as i read along this might be that i started a new one with 10.2 and around that time bought a huge monitor. When i bought the huge one (because a 2 monitor setup was a mess with scaling in the beginning and because of my back and shoulders) i started to have two VM monitors on the same screen to be able to debug GUI-stuff better. Just a thought, speculating...

I can extend my VM to 3 monitors and no change in performance, still annoying little delays, but no worse than on 1 monitor.

Share this post


Link to post
7 hours ago, Mike Torrettinni said:

I can extend my VM to 3 monitors and no change in performance, still annoying little delays, but no worse than on 1 monitor.

Have you tried Remote Desktop yet?

Share this post


Link to post
Guest
7 hours ago, Mike Torrettinni said:

I can extend my VM to 3 monitors and no change in performance

Do you mean 3 physical monitors? Or 3 virtual monitor-windows on the same physical screen?

Share this post


Link to post
6 hours ago, dummzeuch said:

Have you tried Remote Desktop yet?

I did, and it seems a bit smoother experience with Windows overall ( I assume due to RDP Experience setting: Detect connection quality automatically), but no difference in Delphi experience.

I didn't know you can actually RDP to local VM, quite interesting!

Share this post


Link to post
6 hours ago, dummzeuch said:

Have you tried Remote Desktop yet?

The limitations on RDP are very sad. I understand in Windows 7 that Ultimate was a requirement for multiple -- not spanned -- monitor operation. Not happy with it, but at least it was a clear policy position.

With Windows 10, I have searched and searched, and have yet to find any clear statement as to multiple monitor operations with RDP. Surely it can't require such specific language to reach a clear answer?

I do all my dev work in VMs, and always have multiple monitors available, but spanning is worse than useless, when a window maximizes to the spanned desktop, and screen-center dialogs are routinely split between screens. Historic limits on the functionality are understandable, but with the great proliferation of high bandwidth connections, we really should have better functionality available.

Share this post


Link to post
5 hours ago, Dany Marmur said:

Do you mean 3 physical monitors? Or 3 virtual monitor-windows on the same physical screen?

Yes, 3 physical monitors - I have these options when in Full screen mode:

 

image.png.7525ee47e970d07d5338fe685020180a.png

 

Same performance in any layout.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×