By default, the content of your Azure App Service site is actually stored in Azure Storage and shared between the app service instances. Whenever the servers hosting your Azure Storage contents are updated (be it Windows Update or whatever), your app service will be restarted in order to point it to the new host for your files.
Azure App Service Local Cache improves performance and web app uptime by copying your files to local storage. It does so by introducing a local cache on each web app instance.
More exactly:
When you web app starts, it copies the files from central Azure Storage to your local cache.
The local cache handles reads and writes, but the writes are never sent to the central Azure Storage.
When you restart your app, it will discard the local cache and reread the files from the central Azure Storage.
When publishing changes (for example from Visual Studio), they don't become visible to your apps until restarted.
This gives you much better file read/write performance for your website. It also means you get fewer restarts due to Azure Storage Share changes (but you need to restart after publishing your app).
The Local Cache feature will host all files in /site or /siteextensions
Local Cache is not supported in the F1 or D1 tier.
I just published new changes, but my app does not seem to have them. Why?
If your app uses Local Cache, then you need to restart your site to get the latest changes.
How to enable Local Cache
Navigate App Service Panel, click Configuration, add +New application setting
Name: WEBSITE_LOCAL_CACHE_OPTION Value: Always
Checked the "Deployment slot setting" checkbox
Name: WEBSITE_LOCAL_CACHE_SIZEINMB Value: 1000
Checked the "Deployment slot setting" checkbox
Save (It restarts the app service)
By default, the local cache size is 1 GB. If your content size is over 1 GB you can change the limit up to 2 GB
Azure App Service Dynamic Cache
The Dynamic Cache is similar to Local Cache, with one major difference:
Files written by your web app will be persisted.
This means:
The dynamic cache handles reads and writes. The writes are sent to the central Azure Storage. Other web app instances will get the updated files, but there is a delay (around 10 seconds). When publishing changes (for example from Visual Studio), there is also a delay until it propagates to the web app caches.
WEBSITE_DYNAMIC_CACHE=1 means both files and their metadata are cached. WEBSITE_DYNAMIC_CACHE=2 means only metadata is cached. This makes the cache much smaller, but you don't get the same performance increase.
How do I verify that the web app's local cache instance is serving up the content and not from a shared network location?
You will need to navigate to;
yourwebsitename.scm.azurewebsites.net/Proce.. and find the properties column for the w3p without the scm tag. Click Properties. And switch the Environment Variables, switch down to end of page, find WEBSITE_LOCALCACHE_READY, TRUE
Or you can check this URL :
YourAppServiceName.scm.azurewebsites.net/ap..
Find the following record :
For more information:
https://learn.microsoft.com/en-us/azure/app-service/overview-local-cache
https://learn.microsoft.com/en-us/azure/app-service/reference-app-settings?tabs=kudu%2Cdotnet