You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/app-service/overview-local-cache.md
+16-16Lines changed: 16 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,7 @@ tags: optional
5
5
6
6
ms.assetid: e34d405e-c5d4-46ad-9b26-2a1eda86ce80
7
7
ms.topic: article
8
-
ms.date: 06/29/2023
8
+
ms.date: 02/28/2025
9
9
ms.custom: UpdateFrequency3
10
10
ms.author: msangapu
11
11
author: msangapu-msft
@@ -14,10 +14,10 @@ author: msangapu-msft
14
14
# Azure App Service Local Cache overview
15
15
16
16
> [!NOTE]
17
-
> Local cache is not supported in function apps or containerized App Service apps, such as in [Windows Containers](quickstart-custom-container.md?pivots=container-windows) or in [App Service on Linux](overview.md#app-service-on-linux). A version of local cache that is available for these app types is [App Cache](https://github.com/Azure-App-Service/KuduLite/wiki/App-Cache).
17
+
> Local cache isn't supported in function apps or containerized App Service apps, such as in [Windows Containers](quickstart-custom-container.md?pivots=container-windows) or in [App Service on Linux](overview.md#app-service-on-linux). A version of local cache that is available for these app types is [App Cache](https://github.com/Azure-App-Service/KuduLite/wiki/App-Cache).
18
18
19
19
20
-
Azure App Service content is stored on Azure Storage and is surfaced in a durable manner as a content share. This design is intended to work with a variety of apps and has the following attributes:
20
+
Azure App Service content is stored on Azure Storage and is surfaced in a durable manner as a content share. This design is intended to work with a various apps and has the following attributes:
21
21
22
22
* The content is shared across multiple virtual machine (VM) instances of the app.
23
23
* The content is durable and can be modified by running apps.
@@ -29,30 +29,30 @@ While many apps use one or all of these features, some apps just need a high-per
29
29
The Azure App Service Local Cache feature provides a web role view of your content. This content is a write-but-discard cache of your storage content that is created asynchronously on-site startup. When the cache is ready, the site is switched to run against the cached content. Apps that run on Local Cache have the following benefits:
30
30
31
31
* They are immune to latencies that occur when they access content on Azure Storage.
32
-
* They are not affected by connection issues to the storage, since the read-only copy is cached on the worker.
32
+
* They aren't affected by connection issues to the storage, since the read-only copy is cached on the worker.
33
33
* They have fewer app restarts due to storage share changes.
34
34
35
35
> [!NOTE]
36
36
> If you are using Java (Java SE, Tomcat, or JBoss EAP), then by default the Java artifacts--.jar, .war, and .ear files--are copied locally to the worker. If your Java application depends on read-only access to other files as well, set `JAVA_COPY_ALL` to `true` for those files to also be copied. If Local Cache is enabled, it takes precedence over this Java-specific enhancement.
37
37
38
38
## How the local cache changes the behavior of App Service
39
39
*_D:\home_ points to the local cache, which is created on the VM instance when the app starts up. _D:\local_ continues to point to the temporary VM-specific storage.
40
-
* 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, but can be increased to 2 GB. Note that as the cache size increases, it will take longer to load the cache. If you've increased local cache limit to 2 GB and the copied files exceed the maximum size of 2 GB, App Service silently ignores local cache and reads from the remote file share.
40
+
* 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, but can be increased to 2 GB. As the cache size increases, it takes longer to load the cache. If you've increased local cache limit to 2 GB and the copied files exceed the maximum size of 2 GB, App Service silently ignores local cache and reads from the remote file share.
41
41
> [!IMPORTANT]
42
42
> When the copied files exceed the defined Local Cache size limit or when no limit is defined, deployment and swapping operations may fail with an error. See the [FAQ](#frequently-asked-questions-faq) for more information.
43
43
>
44
-
* The local cache is read-write. However, any modification is discarded when the app moves virtual machines or gets restarted. Do not use the local cache for apps that store mission-critical data in the content store.
44
+
* The local cache is read-write. However, any modification is discarded when the app moves virtual machines or gets restarted. Don't use the local cache for apps that store mission-critical data in the content store.
45
45
*_D:\home\LogFiles_ and _D:\home\Data_ contain log files and app data. The two subfolders are stored locally on the VM instance, and are copied to the shared content store periodically. Apps can persist log files and data by writing them to these folders. However, the copy to the shared content store is best-effort, so it is possible for log files and data to be lost due to a sudden crash of a VM instance.
46
46
*[Log streaming](troubleshoot-diagnostic-logs.md#stream-logs) is affected by the best-effort copy. You could observe up to a one-minute delay in the streamed logs.
47
47
* In the shared content store, there is a change in the folder structure of the _LogFiles_ and _Data_ folders for apps that use the local cache. There are now subfolders in them that follow the naming pattern of "unique identifier" + time stamp. Each of the subfolders corresponds to a VM instance where the app is running or has run.
48
-
* Other folders in _D:\home_ remain in the local cache and are not copied to the shared content store.
48
+
* Other folders in _D:\home_ remain in the local cache and aren't copied to the shared content store.
49
49
* App deployment through any supported method publishes directly to the durable shared content store. To refresh the _D:\home\site_ and _D:\home\siteextensions_ folders in the local cache, the app needs to be restarted. To make the lifecycle seamless, see the information later in this article.
50
50
* The default content view of the SCM site continues to be that of the shared content store.
51
51
52
52
## Enable Local Cache in App Service
53
53
54
54
> [!NOTE]
55
-
> Local Cache is not supported in the **F1** or **D1** tier.
55
+
> Local Cache isn't supported in the **F1** or **D1** tier.
56
56
57
57
You configure Local Cache by using a combination of reserved app settings. You can configure these app settings by using the following methods:
58
58
@@ -89,7 +89,7 @@ You enable Local Cache on a per-web-app basis by using this app setting:
89
89
```
90
90
91
91
## Change the size setting in Local Cache
92
-
By default, the local cache size is **1 GB**. 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. Note that it will take longer to load local cache as the size increases.
92
+
By default, the local cache size is **1 GB**. 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. It takes longer to load local cache as the size increases.
93
93
94
94
## Best practices for using App Service Local Cache
95
95
We recommend that you use Local Cache in conjunction with the [Staging Environments](../app-service/deploy-staging-slots.md) feature.
@@ -98,29 +98,29 @@ We recommend that you use Local Cache in conjunction with the [Staging Environme
98
98
* Create a **Staging** slot and publish to your Staging slot. You typically don't set the staging slot to use Local Cache to enable a seamless build-deploy-test lifecycle for staging if you get the benefits of Local Cache for the production slot.
99
99
* Test your site against your Staging slot.
100
100
* When you are ready, issue a [swap operation](../app-service/deploy-staging-slots.md#Swap) between your Staging and Production slots.
101
-
* Sticky settings include name and sticky to a slot. So when the Staging slot gets swapped into Production, it inherits the Local Cache app settings. The newly swapped Production slot will run against the local cache after a few minutes and will be warmed up as part of slot warmup after swap. So when the slot swap is complete, your Production slot is running against the local cache.
101
+
* Sticky settings include name and sticky to a slot. So when the Staging slot gets swapped into Production, it inherits the Local Cache app settings. The newly swapped Production slot runs against the local cache after a few minutes and will be warmed up as part of slot warmup after swap. So when the slot swap is complete, your Production slot is running against the local cache.
102
102
103
103
## Frequently asked questions (FAQ)
104
104
105
105
### What if Local Cache size limit is exceeded?
106
-
When the copied files exceed the Local Cache size limit, the app will read from the remote share. However, deployment and swap operations may fail with an error. See the table below for size limits and results.
106
+
When the copied files exceed the Local Cache size limit, the app reads from the remote share. However, deployment and swap operations may fail with an error. See the table below for size limits and results.
107
107
108
108
|**Local Cache size**|**Coped files**|**Result**|
109
109
| --- | --- | --- |
110
110
|≤ 2 GB|≤ Local Cache size|Reads from local cache.|
111
111
|≤ 2 GB|> Local Cache size|Reads from remote share.<br/> **Note:** Deployment and swap operations may fail with an error.|
112
112
113
113
### How can I tell if Local Cache applies to my app?
114
-
If your app needs a high-performance, reliable content store, does not use the content store to write critical data at runtime, and is less than 2 GB in total size, then the answer is "yes"! To get the total size of your /site and /siteextensions folders, you can use the site extension "Azure Web Apps Disk Usage."
114
+
If your app needs a high-performance, reliable content store, doesn't use the content store to write critical data at runtime, and is less than 2 GB in total size, then the answer is "yes"! To get the total size of your /site and /siteextensions folders, you can use the site extension "Azure Web Apps Disk Usage."
115
115
116
116
### How can I tell if my site has switched to using Local Cache?
117
-
If you're using the Local Cache feature with Staging Environments, the swap operation does not complete until Local Cache is warmed up. To check if your site is running against Local Cache, you can check the worker process environment variable `WEBSITE_LOCALCACHE_READY`. Use the instructions on the [worker process environment variable](https://github.com/projectkudu/kudu/wiki/Process-Threads-list-and-minidump-gcdump-diagsession#process-environment-variable) page to access the worker process environment variable on multiple instances.
117
+
If you're using the Local Cache feature with Staging Environments, the swap operation doesn't complete until Local Cache is warmed up. To check if your site is running against Local Cache, you can check the worker process environment variable `WEBSITE_LOCALCACHE_READY`. Use the instructions on the [worker process environment variable](https://github.com/projectkudu/kudu/wiki/Process-Threads-list-and-minidump-gcdump-diagsession#process-environment-variable) page to access the worker process environment variable on multiple instances.
118
118
119
-
### I just published new changes, but my app does not seem to have them. Why?
119
+
### I published new changes, but my app doesn't seem to have them. Why?
120
120
If your app uses Local Cache, then you need to restart your site to get the latest changes. Don’t want to publish changes to a production site? See the slot options in the previous best practices section.
121
121
122
122
> [!NOTE]
123
-
> The [run from package](deploy-run-package.md) deployment option is not compatible with local cache.
123
+
> The [run from package](deploy-run-package.md) deployment option isn't compatible with local cache.
124
124
125
125
### Where are my logs?
126
126
With Local Cache, your logs and data folders do look a little different. However, the structure of your subfolders remains the same, except that the subfolders are nestled under a subfolder with the format "unique VM identifier" + time stamp.
@@ -135,7 +135,7 @@ As part of the step that copies the storage content, any folder that is named re
135
135
To flush the local cache logs, stop and restart the app. This action clears the old cache.
136
136
137
137
### Why does App Service starts showing previously deployed files after a restart when Local Cache is enabled?
138
-
In case App Service starts showing previously deployed files on a restart, check for the presence of the App Setting - '[WEBSITE_DISABLE_SCM_SEPARATION=true](https://github.com/projectkudu/kudu/wiki/Configurable-settings#use-the-same-process-for-the-user-site-and-the-scm-site)'. After adding this setting any deployments via KUDU start writing to the local VM instead of the persistent storage. Best practices mentioned above in this article should be leveraged, wherein the deployments should always be done to the staging slot which does not have Local Cache enabled.
138
+
In case App Service starts showing previously deployed files on a restart, check for the presence of the App Setting - '[WEBSITE_DISABLE_SCM_SEPARATION=true](https://github.com/projectkudu/kudu/wiki/Configurable-settings#use-the-same-process-for-the-user-site-and-the-scm-site)'. After adding this setting any deployments via KUDU start writing to the local VM instead of the persistent storage. Best practices mentioned above in this article should be leveraged, wherein the deployments should always be done to the staging slot which doesn't have Local Cache enabled.
0 commit comments