Chef runs very slow on a windows machine


#1

I am running the command knife -h on my windows laptop, which has decent specs.

It takes 1 minute and 32 seconds to complete. Some things I tried:
-Adding the verbose command, but there is not any output.
-Knife rehash

What could it possibly be doing for 1 minute and 30 seconds while it brings up the help which is basically a text file?

Does anyone have any troubleshooting tips that they could give me here?


#2

Ruby isn't optimized to run on windows, so even commands that don't leave your machine will end up taking longer to run like chef generate cookbook takes about a minute to run on windows as opposed to almost instant on my Linux workstations. I have been looking into it and everything I have found on the topic basically says that is just how it works.


#3

Can you install "Linux for Windows" and see how it operates inside that quasi-virtualized environment? I actually wanted to do that and did not get the opportunity.


#4

Which version of Chef & knife are you using?


#5

Nico,

I’ve actually tried that, and running Ubuntu inside of Linux for Windows I saw no performance improvement when running knife/chef commands. Yet spinning up an actual Hyper-V guest actually running Linux performs as expected.

So in short the quasi Linux option isn’t a viable workaround.


#6

I haven't tried this myself, so I'm guessing here, but... When running in Windows Subsystem for Linux, check your path - make sure you're executing Linux versions of knife/ruby/etc and not the existing Windows ones.

If you're hitting the Windows executables, then yes, they'll be just as slow.

Great podcast episode on Hanselminutes that cleared up some misconceptions I had about WSL: https://hanselminutes.com/646/inside-linux-on-windows-with-wsl-and-tara-raj