3

I have a fairly simple web application running in an App Service plan in Azure, in a B1 service plan. This plan provides for 1 CPU and 1.75GB of RAM.

The CPU usage never goes above about 5%, and the memory usage is never below 52%.

I did stop the only site running in the plan and the memory usage didn't go down at all. I created a new App Service plan and left it run for a day, and the minimum memory usage was 50% over that time, with no apps running in it.

I know that the reason for this is likely the OS and the services running on the OS, but it's very frustrating getting 50% of the ram that I'm paying for - my app is going to grow over time.

Are there any things I can do to the plan itself, to lower the memory consumption?

With regards to the app, other than disabling features I don't need (like Python and PHP), and setting the app to be 32 bit, are there options there?

Sam
  • 946
  • 7
  • 19
  • Did you check what that memory is used for? What if it's used by IIS? Why do you assume that you have a problem without even deploying your application? – Panagiotis Kanavos Jan 13 '17 at 08:39
  • 2
    @PanagiotisKanavos well, I guess exactly because he didn't deploy the application and 50% of memory is gone. – 4c74356b41 Jan 13 '17 at 09:12
  • @PanagiotisKanavos to my knowledge you can only see Process Explorer on an app, not the service plan. I haven't said there is a problem, but loosing 50% of memory without any app is not a great value proposition. – Sam Jan 13 '17 at 09:24
  • Process Explorer shows all apps and services. If you can RDP inside the VM and run Process Explorer, you can see what is using the memory. On the other hand - it *is* a hosted VM which means it shares memory with other VMs on the same server with over-provisioning. All hosters use virtual memory ballooning to force inactive VMs to release memory. Exclusive RAM requires more expensive plans. – Panagiotis Kanavos Jan 13 '17 at 09:31
  • In other words, don't try to treat your VM as a physical machine. Deploy and *measure* your application first, don't assume there is a memory problem prematurely – Panagiotis Kanavos Jan 13 '17 at 09:33
  • @PanagiotisKanavos I'm talking about an App Service Plan here. There is no VM you can RDP into, at least as far as I'm aware. – Sam Jan 13 '17 at 09:54
  • @Sam when you mentioned Process Explorer I though you meant Process Explorer, ie procexp. Anyway, VMs are VMs and all hosters use ballooning. Don't assume you have a problem until you actually see performance degradation. – Panagiotis Kanavos Jan 13 '17 at 09:56
  • [here](http://stackoverflow.com/questions/41127668/how-to-see-azure-app-service-memory-usage/41131770#41131770) you can find how to check which application within a service plan is causing memory usage. Also, all Apps you create do have the Kudu service running (yoursite**.scm.**azurewebsites.net), which you cannot get rid of. But you can login to the Kudu console and explore all the processes and their memory consumption. You bring interesting point - I never checked the consumed RAM of an empty App Service Plan. – astaykov Jan 13 '17 at 10:36
  • @astaykov The Kudu console shows the same as what you see in the portal. Afaik, it's not possible to get a full task list from the service plan. – Sam Jan 13 '17 at 10:44

1 Answers1

2

That's just how these services work. The 50% is going towards running the operating system (which is probably already fairly well tuned to run as little as possible). It's probably worth mentioning that this number won't remain at 50% when you scale up. If we work on the principle that 900mb is being taken up by "infrastructure", then that number will most likely remain constant when you scale up. So doubling up to the 3.5gb model will mean that the OS is taking up 25% of your available memory.

If you don't access the *.scm.azurewebsites.net site then it won't take up any memory (as it won't be loaded), and if you're sharing the app service plan with other apps of your own then disabling "Always On" will mean that your apps won't take up any memory if they're not being used.

The only services that I'm aware of that don't include the OS in the available memory that you can use are Azure Functions / AWS Lambda.

Matthew Steeples
  • 7,858
  • 4
  • 34
  • 49