chef / chef-workstation

Chef Workstation gives you everything you need to get started with Chef, so you can automate how you audit, configure, and manage applications end environments.
Apache License 2.0
134 stars 112 forks source link

chef-client runs slow from a Chef DK PowerShell prompt #566

Open tpetchel opened 7 years ago

tpetchel commented 7 years ago

Description

I'm relaying a report from a user who's getting started with Chef on an Azure instance. The user is going through Learn the basics, where you run chef-client --local-mode to get a feel for how Chef works. I understand this is not how you typically run Chef in practice.

This issue isn't directly related to Azure; it's simply where we discovered it. (running on a Standard DS1 v2 instance)

Given this basic recipe (call it web.rb)

powershell_script 'Install IIS' do
  code 'Add-WindowsFeature Web-Server'
  guard_interpreter :powershell_script
  not_if "(Get-WindowsFeature -Name Web-Server).Installed"
end

service 'w3svc' do
  action [:enable, :start]
end

ChefDK Version

$ chef --version
Chef Development Kit Version: 2.0.28
chef-client version: 13.2.20
delivery version: master (17c1b0fed9be4c70f69091a6d21a4cbf0df60a23)
berks version: 6.2.0
kitchen version: 1.16.0
inspec version: 1.31.1

Platform Version

Windows Server 2012 R2 Datacenter

Replication Case

  1. Bring up 2 Windows Server instances. The issue was seen on Azure Standard DS1 v2 instances.
  2. On the first instance:
    1. Install Chef DK
    2. Add the recipe above to web.rb
    3. From a Chef DK PowerShell prompt, run chef-client --local-mode two times
    4. Note the time it takes to complete. We've seen 40 minutes for the first run; 5 minutes for the second.
  3. From the second instance:
    1. Repeat the steps from (2) but from a standard PowerShell prompt. We've seen 1 minute for the first run; < 10 seconds for the second.
tyler-ball commented 5 years ago

Thanks for forwarding this report @tpetchel - getting this moved to the correct repo and triaged.

Chef (and Ruby) on Windows is slow and it really sucks. But thank you for the repro that shows there is a distinct slowness using the customer powershell prompt versus a regular powershell prompt. That is something we can go investigate.