PowerShell / DSC

This repo is for the DSC v3 project
MIT License
195 stars 24 forks source link

Need resource definition caching #249

Closed anmenaga closed 4 weeks ago

anmenaga commented 10 months ago

Prerequisites

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

mgreenegit commented 10 months ago

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

anmenaga commented 9 months ago

@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 commented 3 months ago

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.

SteveL-MSFT commented 4 weeks ago

Resolved for PowerShell group resource