Brandon Hawbaker
Brandon Hawbaker

Reputation: 338

How do you improve the performance of the ChefDK commands on Windows 10?

In the past, I've installed the ChefDK on Windows 7 and it ran fairly quickly. Recently, I installed a new version of the ChefDK on Windows 10 Professional 64-bit on a powerful laptop, yet virtually every Chef command I run is incredibly slow. I noticed the Ruby Interpreter is very slow, so there appears to be a problem with how the ruby version included in the latest ChefDK runs on Windows 10.

Configuration:

ruby version: ruby 2.5.5p157 (2019-03-15 revision 67260) [x64-mingw32]
Chef Development Kit Version: 3.9.0
chef-client version: 14.12.3
delivery version: master (9d07501a3b347cc687c902319d23dc32dd5fa621)
berks version: 7.0.8
kitchen version: 1.24.0
inspec version: 3.9.3

I've tried installing one version newer of the ChefDK (3.9.0 from the previous version), which didn't work either. I've also tried the knife rehash command which didn't work either.

How do I run these commands before I grow more gray hair?

For example, on Windows Server 2016, by just running "Measure-Command {chef -v}", I get abysmal results:

Days              : 0
Hours             : 0
Minutes           : 0
Seconds           : 57
Milliseconds      : 697
Ticks             : 576977245
TotalDays         : 0.000667797737268519
TotalHours        : 0.0160271456944444
TotalMinutes      : 0.961628741666667
TotalSeconds      : 57.6977245
TotalMilliseconds : 57697.7245

But when I run on my Windows 10 Enterprise laptop, the results are even worse...

Days              : 0
Hours             : 0
Minutes           : 17
Seconds           : 21
Milliseconds      : 422
Ticks             : 10414222706
TotalDays         : 0.0120534985023148
TotalHours        : 0.289283964055556
TotalMinutes      : 17.3570378433333
TotalSeconds      : 1041.4222706
TotalMilliseconds : 1041422.2706

I expect that running these commands should take a matter of seconds, not minutes.

Update:

After updating the ChefDK it's still slow and not very fast, but it's important new information:

ChefDK version: 4.2.0
Chef Infra Client version: 15.1.36
Chef InSpec version: 4.7.3
Test Kitchen version: 2.2.5
Foodcritic version: 16.1.1
Cookstyle version: 5.0.0
Measure-Command { C:\opscode\chefdk\bin\knife.bat --version }
Days              : 0
Hours             : 0
Minutes           : 0
Seconds           : 10
Milliseconds      : 647

Measure-Command { C:\opscode\chefdk\embedded\bin\knife.bat --version }
Days              : 0
Hours             : 0
Minutes           : 0
Seconds           : 17
Milliseconds      : 480

Upvotes: 2

Views: 370

Answers (1)

Elnur Mammadov
Elnur Mammadov

Reputation: 162

I improved performance using embedded binaries . For example if your chefdk installed on C:\opscode\chefdk , use C:\opscode\chefdk\embedded\bin instead of C:\opscode\chefdk\bin(which added to your global path). There is difference :

Measure-Command { C:\opscode\chefdk\bin\knife.bat --version }

Days              : 0
Hours             : 0
Minutes           : 0
Seconds           : 9
Milliseconds      : 523
Ticks             : 95230328
TotalDays         : 0.000110220287037037
TotalHours        : 0.00264528688888889
TotalMinutes      : 0.158717213333333
TotalSeconds      : 9.5230328
TotalMilliseconds : 9523.0328
Measure-Command { C:\opscode\chefdk\embedded\bin\knife.bat --version }

Days              : 0
Hours             : 0
Minutes           : 0
Seconds           : 3
Milliseconds      : 610
Ticks             : 36100192
TotalDays         : 4.17826296296296E-05
TotalHours        : 0.00100278311111111
TotalMinutes      : 0.0601669866666667
TotalSeconds      : 3.6100192
TotalMilliseconds : 3610.0192

Upvotes: 1

Related Questions