DSC icon indicating copy to clipboard operation
DSC copied to clipboard

Need resource definition caching

Open anmenaga opened this issue 2 years ago • 2 comments

Prerequisites

  • [X] Write a descriptive title.
  • [X] Make sure you are able to repro it on the latest version
  • [X] Search the existing issues.

Steps to reproduce

Currently each dsc.exe operation as a first step performs resource discovery available on the system. This is relatively slow process especially for resource providers like DSC/PowerShellGroup. On the other hand, resource definitions do not change often, so their caching will help a lot with speed of dsc.exe operations.

Expected behavior

NA

Actual behavior

NA

Error details

No response

Environment data

NA

Version

v1

Visuals

No response

anmenaga avatar Nov 01 '23 17:11 anmenaga

Here is the current list of properties

$resourceOutput = [resourceOutput]@{
                type          = $Type
                version       = $r.version.ToString()
                path          = $r.Path
                directory     = $r.ParentPath
                implementedAs = $r.ImplementationDetail
                author        = $r.CompanyName
                properties    = $r.Properties.Name
                requires      = $requiresString
            }

I would like to propose that we do not need "Directory" nor "Author". Thoughts?

I would also propose that we need a -full parameter on dsc resource list that returns all of this information.

Finally, I would suggest that dsc resource cache information could be stored in the following locations.

Windows: [systemdrive]:/programdata/microsoft/dsc/resource.json Linux: /var/lib/microsoft/dsc/resource.json

mgreenegit avatar Nov 06 '23 15:11 mgreenegit

@mgreenegit couple of thoughts:

  1. good idea on locations of cache file: [systemdrive]:/programdata/microsoft/dsc, /var/lib/microsoft/dsc
  2. the format of cache file: it probably should be the format that supports the fastest read/write to the cache. Usually this means a binary, not-human-readable (i.e. not JSON), format.

anmenaga avatar Dec 01 '23 20:12 anmenaga

This is implemented for PS-class-based DSC resources that go through PS adapter; This also needs to be done for new DSCv3 native resources.

anmenaga avatar May 30 '24 00:05 anmenaga

Resolved for PowerShell group resource

SteveL-MSFT avatar Aug 07 '24 22:08 SteveL-MSFT