Azure Websites Memory Usage For Multiple Websites with same DLLs - iis

We are moving a range of Cloud services Web Roles to Azure websites - currently running on App Service plan/pricing tier - Standard 1 medium.
The websites are all identical and at some point we will re-write out code base to be properly multi-tenanted. However we are currently hosting them as multiple websites on a single Azure web hosting plan.
In terms of memory usage will Azure share the identical Dlls e.g. all the Nuget packages/core application Dll? Or do we need enough memory to load a copy of each Dll per websites? Effectively I am hoping to share you can share common assemblies across AppPools.
I have seen mention of settings that MS was adding to IIS to support better density for shared hosting providers. I believe .Net 4.5 added support for interned Dll. Are there any settings etc that affect how Azure handles this situation? We are currently running at 94% memory consumption of our 3.5GB and wanted to understand whether we would need to scale up soon. I would hope Azure would be able to do something under the covers as obviously MS want to maximize density.

Each WebApp is isolated by the app-pool so if you have multiple copies of the same site, even if they are identical, they will all load their own copy of the assembly into memory.
There is also the security sandbox due to the multitenant nature of the service so interning will not work against that.
To monitor memory usage, you can look at the app service plan. Also useful is process explorer (WebApp>tools>process explorer)

Related

Azure WebJob hosting environment

Is there any article or resources that list the type of .NET features and SDKs that work in a standard .NET console application, it does not work in Azure WebJobs hosting environment?
My understanding is that Azure WebJobs hosting environment is a typical windows server VM that includes .NET framework. I expect most of SDK based on .NET such as the variety of Azure SDK or Entity framework should work flawlessly in a WebJobs hosted console application. I like to know things that do not work in a WebJobs hosting environment before I make application design decisions.
I am looking for issues that might arise due to local security policy restriction or low privileged AD identity.
WebJobs run in a secure environment called a sandbox. The execution environment of sandbox is different from a local execution environment mainly due to multi-tenancy — because a single physical machine in the data center can be concurrently executing apps and services belonging to a large number of differing customers.
I like to know things that do not work in a WebJobs hosting environment before I make application design decisions.
The sandbox generally aims to restrict access to shared components of Windows. Unfortunately, many core components of Windows have been designed as shared components: the registry, cryptography, and graphics subsystems, among others. This section outlines the limitations placed on usage of these often essential, yet shared components.
For more information, link below is for your reference.
Azure Web App sandbox

Does Azure allow hosting of n-tier applications?

In Visual Studio 2013, I have a solution that holds several projects, including multiple class libraries, as well as an MVC5 project to serve HTML pages to clients.If I get the free tier, can I host my entire solution, including all the projects that it holds? Microsoft's own documentation on this matter is not clear, and I was hoping someone here has already used the Azure platform for hosting their website.
Does Microsoft's Azure Hosting allow the hosting of n-tier applications?
Sure, why not? You can host every tier of your application separatly in Azure (DBs, web sites, services, background jobs, etc.) in different services provided by Azure. In the free tier you have the limitation of sites you can create for free (Azure Web Sites), limitation of cores (don't know the exact limit) and the costs you produce. If your costs exceeds the limit all of your resources will be shut down.

Slow Orchard Performance on Windows Azure

I have a small Orchard website that I'm hosting on Windows Azure. This website is currently configured to use a FREE web site instance. I've noticed that the first time the site is accessed after a 20-30 minute period, it takes a while (>5 seconds) to load. After that initial load, I can revisit the site, and its fast. I suspect that the app pool is recycling fairly often as its a FREE Azure Web Site instance.
I need this site to load as fast as possible. I'm not opposed to using a different Azure option. I'm just not sure what I should be using.
1) Is there a way in my Orchard site's web.config file to set how often the app pool is recycled? I really need this site to be quick.
2) If I use a "SHARED" Web Site instance, will this get me past the recycling issue?
3) Or, do I need a "RESERVED" Web site instance.
My main goal here is to cost-effectively meet my goal of loading my web site quickly after it hasn't been accessed in a while. I'm just not sure what I can/should do.
Thank you!
I use a combination of the following for performance issues:
I enable Keep Alive module
I enable Warmup module and in Performance settings add my most visited pages
I manually set machine key inside web.config so that sessions last regardless of recycling - this could be an issue if there's not enough memory allocated for the web site inside the IIS
These steps are not related specifically to Azure, but rather to any kind of hosting. Especially when using Azure shared web site instances since they're nothing more than a shared hosting (unlike Azure cloud services)..
Azure web role can easily be made to be fast and avoid the appPool recycle issues, so consider that your plan B after trying all options with Azure websites.
I haven't tried with Azure websites, so it may or may not be possible there. Info is vague as to whether or not you can configure the idle timeout setting for a reserved instance. One thing you can try is to use the warm-up feature (dashboard -> performance). This should periodically load some pages, which would prevent idle timeout of the appPool. You might also try external services like pingdom.com or something similar that would periodically ping your site to prevent it from recycling.
If you end up switching to web roles, you will definitely be able to do this. The latest Orchard builds (v1.6+) set the appPool idle timeout to 0 (never timeout) by default. You will in general get a lot more control over performance and other configuration if you use web role rather than azure websites. The main drawback with this choice is you lose some of the deployment options, and deployments take a lot longer (they are still easy, they just take a while).

Is azure for big applications only?

I've recently been asked to redevelop an .Net 2.0 WinForms application with a back end SQL Server Express DB.
One of the requirements is to allow remote users access to the application, so I've been considering hosted options to avoid VPN setup. The data is not sensitive and does not fall under data protection act, so a basic security approach for the web will cover me.
I like the idea of using Azure for a few reasons, but I'm not sure if a good fit for a users base of 5 or 6 with no real scope to grow. I've never used Azure and I plan to develop using MVC and a SQL backend as this is my main skillset.
A few points in favour of Azure in my mind are:
Tight integration with the TFS preview that I'm using for this project
Easy to setup a sandpit and a live version
Easy maintenance as I expect other hosted options will require more knowledge of underlying OS
Sticking to a full Microsoft stack should hopefully make things simpler
From what I find on the Azure site the message is all about scalability, which is great if you need it.
My question is simply, do you need a large user base, or plans to grow quickly, to use azure or is it how we should be hosting apps now?
What you're asking here is the perfect case for Windows Azure Web Sites:
You get 10 web sites for free (no custom DNS, but this is perfect for your 'sandpit'/test version). The shared mode supports custom DNS and is very cheap.
Tight integration with TFS preview and GitHub
You don't need to worry about the underlying OS, you simply publish from Visual Studio or with TFS Preview.
Sticking to the Microsoft stack is the easiest solution, but other technologies work great aswell. Since you're talking about MVC I'm assuming you are considering ASP.NET MVC, which is a perfect match with Windows Azure. Take a look at the training kit for some good examples.
The day you'll need a solution which more scalable (meaning you'll have more users and more income) you can easily upgrade to a reserved instance or to a Cloud Service (Web/Worker Role).
About your question: "My question is simply, do you need a large user base, or plans to grow quickly, to use azure or is it how we should be hosting apps now?"
Windows Azure is a cloud service platform (includes PaaS as Cloud Services, IaaS as Windows Azure Virtual Machines and also Websites suggest by Sandrino above), and with cloud services you have ability to start very small and grow as much and as quickly as your user requirement is, so you can use Azure with both cases. On the other hand there are some advantages using certain offering depend on your which service you are going to use to run your application.
I think article (Section: "What Should I Use? Making a Choice") will explain the strategy about how you make a selection among various services.
This SO discussion does talks about the difference between cloud Services and Azure WebSites as well.

App pool timeout for azure web sites

is there a way to set the timeout of an app pool of a web-site running under azure sites.
I have a site running there and it seems like it needs to spin up again when it has been idle for a while.
Since the relevant answer is in the comments it is easy to miss it. Currently Azure Web Apps support the Always On feature, that keeps your app in memory. It is available in Basic and upper tiers and you can configure it from the portal:
Resource_Group > Web App > Settings > Application settings
If you want to achieve the same effect in Free or Shared tiers you can create a webjob that will ping your website to keep it in memory. There are numerous blog posts how to achieve this 1, 2, etc.
Windows Azure Web Sites supports two modes, shared and Reserved.
In Shared mode, your web site process (w3wp) runs alongside other, sharing resources including CPU and memory. The runtime (that is Windows Azure Web Sites system) remove sites from memory after period of idleness – that is when your site doesn’t get any traffic. The runtime make the decisions removing sites, bases on many parameters, and even if you change the configuration, it may not apply, as the runtime may override that configuration.
If you are looking for your site to always be in memory, you may want to look into switching to Reserved Instance, in which your site(s) are running on their own VM(s) and the system is much more flexible in terms of resource utilization.
Yochay (PM Azure Web Sites)
If you're referring to the new Windows Azure Web Sites, I don't believe you have any option for controlling app pool timeout. This is a shared, managed service, where you simply upload your site, with the details of IIS etc. taken care of for you. You can look through the published management page, and you'll see that this is not an option.

Resources