microsoft / IIS.ServiceMonitor

An entrypoint process for running IIS in Windows containers
MIT License
126 stars 42 forks source link

Reduce the Number of calls to APPCMD #12

Closed mcy94w closed 6 years ago

mcy94w commented 6 years ago

ServiceMonitor use to call AppCmd twice per environment variable, which has a huge impact on container startup time.

Implements: Combine appcmd calls together by operates multiple environment variable as once.

EX. .\appcmd.exe set config -section:system.applicationHost/applicationPools /+"[name='DefaultAppPool'].environmentVariables.[name='foo1',value='bar1']" /commit:apphost

.\appcmd.exe set config -section:system.applicationHost/applicationPools /+"[name='DefaultAppPool'].environmentVariables.[name='foo2',value='bar2]" /commit:apphost

is now accomplished in one call

.\appcmd.exe set config -section:system.applicationHost/applicationPools /+"[name='DefaultAppPool'].environmentVariables.[name='foo1',value='bar1']" /+"[name='DefaultAppPool'].environmentVariables.[name='foo2',value='bar2']" /commit:apphost

Service will only call appcmd twice: 1 Remove all the environment variable from applicationHost.config. 2 Add all the environment variable to applicationHost.config.

mcy94w commented 6 years ago

https://github.com/Microsoft/IIS.ServiceMonitor/issues/9

bariscaglar commented 6 years ago

@mcy94w this looks like ready. Do you need a review?