App Service on Linux WEBSITES_ENABLE_APP_CACHE actually read only volume?

549 Views Asked by At

When using WEBSITES_ENABLE_APP_CACHE is it actually a read only volume that is mounted to /home/site/wwwroot?

I'm testing out the WEBSITES_ENABLE_APP_CACHE app setting on a App service hosting a NextJS application on App service on linux. Because we are experiencing some serious latency on cold start, which we suspect is latency related to fetching module files from Azure Storage. The NextJS cache folder is deleted on publish or restart of site, but the site recreates the folder and add files (images) to the folder. If the volume was read only this should not be possible, but maybe for some reason the setting is not activating the cache in my App service? How can I tell that the cache is active? Other than the environment setting.

The cache folder is located at /home/site/wwwroot/.next/cache.

I'm also facing av problem with disable the feature. After removing the setting, it is not possible to deploy new versions of the app. The deployment looks successfully i Azure DevOps release pipeline, but the web application still serves the old version. I had to re enable the cache by adding the app setting WEBSITES_ENABLE_APP_CACHE back, then do a new deploy, an finally the new version was served by the app service. Anyone experience the same?

1

There are 1 best solutions below

6
Suresh Chikkam On

The WEBSITES_ENABLE_APP_CACHE setting in Azure App Service on Linux is used to enable or disable caching of files in the /home/site/wwwroot directory, where your application code resides.

Read-Only Volume:

  • The /home/site/wwwroot directory itself is not a read-only volume, but the cache mechanism operates with a read-only copy of your application content during cold starts.
  • During a cold start, Azure uses the cached version of your application to quickly spin up new instances. This cached directory is located at /home/site/wwwroot/.appservice.

Verifying Cache Activation:

  • To confirm that the cache is active, you can access the "Advanced Tools" or "Kudu" interface for your App Service instance.

enter image description here

  • In Kudu, navigate to the file system and check if the .appservice cache folder exists and contains files. If it's empty or missing, the cache might not be functioning correctly.