Does anyone know if you take a performance hit calling CloudConfigurationManager GetSetting method? Does it reparse the azure file for example or is it cached? Not sure if
No, it is not cached, as you suggested you would have to create you own caching for performance improvement.
The source is available on github.
If you take a look at the source you can see that it isn't doing any caching, so if you are seeing performance issues you may want to implement your own caching.
The body of GetSetting
shows a simple return:
value = GetValue("ServiceRuntime", name, GetServiceRuntimeSetting);
if (value == null)
{
value = GetValue("ConfigurationManager", name, n => ConfigurationManager.AppSettings[n]);
}
return value;
The accepted answer might not be correct.
It's true that CloudConfigurationManager
itself does not cache, but that's because it internally delegates to ConfigurationManager
or WebConfigurationManager
, which do cache values.
From MSDN:
For
<appSettings>
and<connectionStrings>
, you use the AppSettings and ConnectionStrings properties. These methods perform read-only operations, use a single cached instance of the configuration, and are multithread aware.
So that even if you access from CloudConfigurationManager
directly, most probably, there would be no IO operation incurred.