Azure app service with multiple production slots - azure

Let's say I have an azure app service with 4 slots used for production, each one with a 25% traffic.
Is it possible to have just one pre slot and swap it to the four production slots? Or how would you achieve this? We've thought of having 4 pre slots, one for every production slot, but seems a bit of a mess, surely there's a better option to have multiple production slots and the benefits of swapping...

The concept of slot.
Set up staging environments in Azure App Service
Simply put, when creating a webapp, the default webapp belongs to the Production slot. At this time, we can create other slots.
Under normal circumstances, a test slot is usually created, and the test slot is updated with the latest program, so that the latest program can be deployed during swap. Generally, when the program has new functions, it is used for some users to distribute traffic. When there are different versions of the program that need to be run at the same time, then you can create the same 4 slots as you.
But your 4 slots, you want to achieve the purpose of updating all 4 slots through a swap operation. This is really strange. This is why CSharpRocks asks you in conmment. Because your 4 slots are in the same app services plan, creating 4 slots will not improve performance.
You may be thinking of multiple instances to extend your webapp, which can improve the performance of your webapp.

Related

WebJobs in multiple deployments slots and StorageAccounts

I am trying web-jobs using deployment slots (dev, qa, prod). It seems like each slot seems to need its own storage-account, as when I try and use the same storage account, the jobs (its a time based job) runs only in one of the slots. In all the others, the job never fires.
I have tried provisioning another storage account and when I set the connections strings (AzureWebJobsDashboard, AzureWebJobsStorage) in QA, the jobs begin firing (which seems to prove that I need multiple storage accounts). But I dont want to have to pay for 3 separate storage accounts, where the dev and qa will not be used all that much. Is there any setting that can be used that will allow one storage-account to be used by different slots?
You don't need a different storage account, but you do need to set a different HostId on the JobHostConfiguration object. You can use an environment variable to read it, and then set that to different values as a Slot App Setting in each of your slots.
See https://github.com/Azure/azure-webjobs-sdk-extensions/issues/56 for related info.

Azure Service Plans and non-production slots

I m looking for the best practice when it comes to azure service plans in a microservice architecture. We have a series of microservices where each is completely independent from each other both in terms of capacity, resources, developers and overall architecture. It goes without saying that if one service experiences issues the other ones should not be affected if not interacting with the problematic service. Those services are hosted in Azure
My question is around Service Plans and how those should related to dev / staging environments. Up until now we would create a service plan for our microservice, call it PersonService. So we would create the PersonService service plan and then the default slot would be production (person-service) and then we would have another staging slot (person-service-staging) to cater for staging / testing needs. All of those would be served under the same service plan.
A terrible thought came to me today that if a dev deploys some horrible bug in staging that eats up all the CPU and / or mem then the production slot would starve from those resources and essentially the staging environment would be affecting the response times of production.
Am I right to think this would be the case? How do you guys recommend to set this up to avoid this issue? Thanks
Yes you are correct, if person-service-staging starts to consume a significant proportion of the underlying server's resources, it will affect person-service.
Avoiding it very much depends on your current set up and what your priorities are. Adding a dev / test / staging service plan is by far the easiest approach. This leaves your production service plan solely for production ready code. With deployment slots there simply to allow for easy switching between versions (and quick rollback if you realise something in production is broken)
The alternative to this is having a service plan that is solely dedicated to staging that you deploy as part of your testing pipeline. The speed with which Azure can stand up a service plan means that you can create and destroy them on the fly. This gives you the benefit of being able to performance test against your staging server, when it is running on an identical plan to your production code.
One of the major benefits of cloud computing is the ability to crate disposable servers. It takes a deliberate thought to shift out of the old philosophy of 'that's our staging server' Even in a CI scenario - unless you're deploying code every 30 mins! - it can be much cleaner to throw some new servers up to test against. Even if you don't have an automated test pipeline, it is only a matter of a couple of Azure Automation scripts connected to a button on a webpage (though it is surprising how quickly those couple of scripts multiply! into something much more elegant / complicated)

Do slots count as VMs in Azure?

I currently have a web application deployed to Azure on the App Service free plan and, as part of going live, I'm interested in moving to the use of slots.
This is primarily because it gives me the ability to deploy new code into staging and then seamlessly swap over once it's been validated.
Now, to use slots, I know I need the standard plan and this clocks in at a minimum of $X per VM.
What I don't know (and frustratingly haven't been able to find out from the Azure stuff on Microsoft's web pages) is whether a second slot counts as another VM.
In one place at least, it states that deployment slots are live web applications with their own hostname but that could be read in at least two ways. either as a separate app on the same VM or a separate VM altogether.
Since the difference is substantial ($2X/month rather than $X/month), it's rather important to planning. So does anyone know how (preferably with some supporting citation from Microsoft) the slots are handled and charged for?
All deployed Azure sites in a given Web App plan run on the same VM instances. Just as if you deployed mysite1.azurewebsites.net and mysite2.azurewebsites.net in the same plan, they'd share the same VM instances. So, too, do extra deployment slots.
If you scale to 3 instances, you pay for 3 instances, and all deployments (all slots for all deployments) run on all three instances.
One way to make this easier to think about: the 'production' (or main) deployment slot is just another slot.

What is the difference between an Azure Cloud Service Staging Slot and an Azure Web App Staging Slot?

This question is also to do with why one gets charged double for Cloud Service instances, and I believe that the answer in my case is due to the fact that I have a Cloud Service Staging Slot which is actually a seperate VM whereas a WebSite Staging slot is just another website instance on the same VM, so you pay the same.
So to pay for one Cloud Service instance ie around 700 hours in a month, one must only have the "Production" slot, the "Staging" slot must be deleted.
Am I correct?
In Cloud Services you're paying the resources you use, meaning that if you have a Production slot and a Staging slot, you pay for both, as you already mentioned.
In App Service (Web Apps, API Apps, Mobile Apps) we support staging slots (multiple ones, not only 1) in Standard and Premium. Each plan has some Staging slots included and you don't pay anything extra. Standard has 5 and Premium has 20. You can find more information at App Service plans
To pay only for the hours you mentioned, you need to only have either Production or Staging running, not both at the same time. Having said that, with the per minute billing Azure has, even if you have Staging running for a small amount of time until you do a swap, the impact on your bill will be really low if it's only a couple of minutes each time.

If an Azure Deployment slot it is turned off are you still charged for the machine it runs on?

I have a few Azure websites running on Reserved instances that have Auto-scale turned on so they will take 1->6 servers but are usually just running on one server. I am trying to set up hot-swapping so that when I deploy there is no down time. I have created a deployment slot but am I charged extra for the deployment slot? Even if it is turned off?
This is the only reference I could find relating to this: Managing Multiple Windows Azure Web Site Environments...
To quote:
That’s the only site that would cost money, so the development and
staging sites would have no impact on the cost I’ll incur for this
setup.
I believe that the slots are part of the instance, and that the number of slots that are in use makes no difference in pricing - they are tied to the instance.
Anecdotally, I run a number of slots for QA, Staging and other environments, and the cost has not changed with respect to the number of slots used.

Resources