Search code examples
asp.net-mvcazureout-of-memoryazure-web-app-serviceazure-diagnostics

Azure app service availability loss. The memory counter Page Reads/sec was at a dangerous level


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

enter image description here 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?


Solution

  • What 'The memory counter Page Reads/sec' means?

    We could get the answer from this blog. 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.

    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.