Question: Environment:
Asp Net MVC app(.net framework 4.5.1) hosted on Azure app service with two instances.
App uses Azure SQL server database.
Also, app uses MemoryCache (System.Runtime.Caching) for caching purposes.

Recently, I noticed availability loss of the app. It happens almost every day.
[![enter image description here](https://i.stack.imgur.com/ExZnC.png)](https://i.stack.imgur.com/ExZnC.png)

[![enter image description here](https://i.stack.imgur.com/ZmXAq.png)](https://i.stack.imgur.com/ZmXAq.png)
Observations:
The memory counter Page Reads/sec was at a dangerous level (242) on instance RD0003FF1F6B1B. Any value over 200 can cause delays or failures for any app on that instance.

What 'The memory counter Page Reads/sec' means?
How to fix this issue?

Answer: 
> 
> What 'The memory counter Page Reads/sec' means?
> 
> 
> 

We could get the answer from this [blog](https://www.sqlshack.com/sql-server-memory-performance-metrics-part-3-sql-server-buffer-manager-metrics-memory-counters/). The recommended Page reads/sec value should be under **90**. Higher values indicate **insufficient memory** and **indexing issues**.

> 
> “Page reads/sec indicates the number of physical database page reads that are issued per second. This statistic displays the total number of physical page reads across all databases. Because physical I/O is expensive, you may be able to minimize the cost, either by using a larger data cache, intelligent indexes, and more efficient queries, or by changing the database design.”
> 
> 
> 

---

> 
> How to fix this issue?
> 
> 
> 

Based on my experience, you could have a try to [enable Local Cache in App
Service](https://learn.microsoft.com/en-us/azure/app-service/app-service-local-cache-overview#enable-local-cache-in-app-service).

> 
> You enable Local Cache on a per-web-app basis by using this app setting: **WEBSITE\_LOCAL\_CACHE\_OPTION = Always**
> 
> 
> By default, the local cache size is **300 MB**. 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 web app.
> 
> 
>
There is some memory performance problems can be listed

* excessive paging,
* memory shortages,
* memory leaks

Memory counter values can be used to detect the presence of various performance problems. Tracking counter values both on a **system-wide** and a **per-process** basis helps you to pinpoint the cause in Azure such as in other systems.

Even if there is no change in the process, a change in the system can cause memory problems. the **system-wide**

**researching in the azure**:

Shared resources plans (Free and Basic) have memory limits as seen here: <https://learn.microsoft.com/en-us/azure/azure-subscription-service-limits#app-service-limits>.

**Quotas**: <https://learn.microsoft.com/en-us/azure/app-service-web/web-sites-monitor>

Also, you can check in the portal under your web app settings, search for “quotas”, and also check out “Diagnose and solve problems” and hit “metrics per instance (app service plan)” which will show you memory used for the plan.

A MemoryCache bug in .net 4 can also cause this type of behavior
<https://stackoverflow.com/a/15715990/914284>