Appservice swap operation is failing due to local cache?

Frode Solvang 6 Reputation points
2021-05-05T08:20:05.767+00:00

Swap between staging and production slots is failing both from ps and Azure Portal.
The diagnostics says:
Local cache refresh for site failed as size for local cache 2001Mb is > 95% of quota 2000Mb

According to documentation the local cache contains a one-time copy of the /site and /siteextensions folders but as far as I can see my site + siteextension is approxx 200MB.

Why is the swap failing with this amount of content?

Any tips or help to solve this is appreciated!

-Frode

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

3 answers

Sort by: Most helpful
  1. SnehaAgrawal-MSFT 22,706 Reputation points Moderator
    2021-05-05T13:34:48.713+00:00

    Thanks for asking question! As defined here that the local cache contains a one-time copy of the /site and /siteextensions folders of the shared content store, at D:\home\site and D:\home\siteextensions, respectively.

    The files are copied to the local cache when the app starts. The size of the two folders for each app is limited to 1 GB by default note that this includes the /site and /siteextensions folders that are copied from the content store, as well as any locally created logs and data folders.

    To increase this limit, use the app setting WEBSITE_LOCAL_CACHE_SIZEINMB.

    You can increase the size up to 2 GB (2000 MB) per app.

    Further you may want to know that the App Service silently ignores local cache and reads from the remote file share. If there is no limit defined or the limit is set to anything lower than 2 GB and if the copied files exceeds the limit, the deployment or swap may fail with an error.

    Also the best practices for using App Service Local Cache is to use local cache in conjunction with the Staging Environment feature.

    Add the sticky app setting WEBSITE_LOCAL_CACHE_OPTION with the value Always to your Production slot. If you're using WEBSITE_LOCAL_CACHE_SIZEINMB, also add it as a sticky setting to your Production slot.

    Let us know if there is further query or issue remains.


  2. SnehaAgrawal-MSFT 22,706 Reputation points Moderator
    2021-05-28T09:36:38.85+00:00

    Update: The issue has been resolved after creating webjob to clean the logs and disabling local cache.

    0 comments No comments

  3. Pontus Berggren 0 Reputation points
    2024-02-06T20:02:30.4+00:00

    I am experiencing a failure trying to slot swap while having WEBSITE_LOCAL_CACHE_OPTION set to 'Always' for a Blazor app in an App Service. "Exceeded maximum status polling attempts for swap between slot 'testslot3' and slot 'production'. Check Activity log to confirm operation status/result."

    Setting the cache to 'Disabled' lead to some down time in Production. Shall this be seen as a Bug or simply lack of support?

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.