Purpose of Local Cache in App Service

Karl Gardner 85 Reputation points
2024-07-23T04:45:19.76+00:00

Hello,

My understanding of the local cache is that the local cache is the entire D:/home directory. So basically their are the site, siteextensions, Data, and LogFiles folders in the home directory (local cache). If the local cache is enabled the only thing that changes is that whenever the Data and LogFiles folders are copied to the shared content store (the files shared between all vm instances) their will be new subfolders in them that follow the naming pattern of "unique identifier" + time stamp. To the best of my knowledge you are not able to write any data to this home directory with application code other than the static files in the wwwroot of aspnetcore apps.

Now, based on reading this section: https://learn.microsoft.com/en-us/azure/app-service/overview-local-cache#best-practices-for-using-app-service-local-cache

I'm not seeing any reason or benefits to actually using the local cache in azure app service from this or at least my understanding from reading this. Let's say I have the app setting WEBSITE_LOCAL_CACHE_OPTION set to Always with the deployment slot setting checked so that it will stick to the production slot. Then, once I swap the production and the staging slot, the production slot will still use the local cache (D:/home) containing the site siteextensions, LogFiles, and Data folder. So, once it swaps it is still using all the contents of the D:/home local cache and hasn't actually swapped. It isn't till I restart the web app:

User's image

then the local cache gets replaced with the shared content store. Wondering what the purpose of the local cache setting actually is if my understanding about this is correct. Seems like their is a purpose having to do with the deployment slots but wasn't clear in the documentation.

Thanks!

Karl Gardner

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
7,408 questions
0 comments No comments
{count} votes