Why slow chef synchronization for local cookbooks

Background

I start chef-client --local-modewith the cookbook pool installed in ./berks-cookbooksthese cookbooks, which are already loaded by berkshelf before launching the chef. (chef sdk 4.0.0, berkshelf 3.2.3)

Before running my scripts, the chef must run Sync Cookbooks, and this step takes 2 to 3 minutes. I understand that the chef is downloading dependent cookbooks at this time and checking their hashes.

my question

If I use berkshelf and already have cookbooks stored locally, why does the chef spend so much time downloading cookies?

Does anyone know a way to speed it up?

+4
source share
1 answer

I also thought about this, and finally took a break at the chef's process to see what he was doing. For each cookbook available to the client chef when running in local mode, he reads the files in all other cookbooks that are available (and, even worse, it seems that he does this more than once for each cookbook).

This means that the time for synchronizing cookbooks in local mode will increase with the square of the number of cookbooks available.

One thing you can do to minimize this time is to remove all unnecessary cookbooks before starting - i.e. Sync your cookbooks manually before hand and delete those that will not be used.

, , , , , .

+5

All Articles