Chef is slow on Windows VMs

Currently we are using chef-client version 17.10.3. We configure our windows vms using Octopus Deploy and using a "Converge chef recipe" step within the deployment process. The Converge chef recipe step is currently taking 30+ mins to deploy to our windows vms. Were not sure if its ruby being a factor here or it is something else that is causing the slowness on our windows vms. Octopus itself is not the issue as we also ran the converge chef recipe step locally on the windows vms and it still took around 30+ mins. Wondering if there is a way to speed up the deploy process on windows vms? Some have mentioned maybe switching to WSL as that could possibly improve the speed but any other suggestions?

What really needs to be done is to figure out what part of your converge is taking so much time. Is each resource slow or is there a particular resource or two that take a very long time. If there is an app install or some other operation in your Chef code then moving to WSL might not speed anything up at all.
I recall reading about a way to find the slowest resources in a converge. Perhaps this is in Test Kitchen? We don't use Test Kitchen, and I've never used that capability. If I needed to do this I'd use WinTail to watch the chef-client log or run chef-client from a command prompt, and just see where it's hanging up.

We use Chef + Octopus in exactly this same way. Our first-time converges typically take 5 minutes or so on a new system and a couple minute thereafter. It doesn't sound like the interplay w/ Chef and Octo are an issue for you either; just what Chef is doing no matter how it's run.

1 Like

Thanks for the response,

I did run chef-client with --slow-report from the command prompt on one of our windows vms and it showed the 10 slowest resources all included 'choclatey_package' or 'powershell_script'.

Ahh... I see why I couldn't find that. The --slow-report feature was added in Chef-Client 17.x and we're still using Chef-Client 16.x.

Figuring out which use of those resources is a problem would be next. This is very specific to your companies implementation of Chef as what those resources do is situational. The time penalties here are likely outside of Chef with the greater impact being inside what Choco is doing and/or what PowerShell scripts are being used.

1 Like

Ok will look into see if we can manipulate or edit those resources to speed up the deploy. Thanks for the help.