I have hosted my website in microsoft azure web role. My website works like application and service. Each time user approaches the site, request goes to the service, finishes its database related queries and return backs to application part. Since it has two ways, i have used web roles for both application and service.
- If the number of users reaches maximum, an instance is created in web role, what would happen to my service side since it involves database related things.
- Everytime when the instance is created, would database be created along with that?
- In my case, i would like to see everytime instance is created, no duplicate database should be created. Is it possible? If its possible, do deadlock occurs in that case?
- Is it possible to host a application and service both in same web role. If so, i would like to see only database should be created each instance is created.
Please provide a clear solution on this.
Assuming that the application and service are running under two separate cloud services:
- Your Application and Service roles are configured to scale independently.
- Assuming your are using an Azure SQL Database, it would also be scaled independently of the cloud service.
- No duplicate database would be created - Azure SQL databases would again be scaled independently of the cloud services.
- If your Application is, say, an ASP.NET MVC application, and your service is a WebAPI, they could both be hosted under the same cloud service (they'd be in the same web application)
How your Service application would behave in a scaled scenario will really depend on how it's been implemented.
I think you have a misunderstanding about how scaling works with Azure.
Check here for some additional detail: How to Scale a Cloud Service
As an aside, you may want to consider Azure Web App instead of a Cloud Service. Whilst they offer less control that a cloud service, unless you are doing something specific that an Azure Web App can't offer, they are easier to deal with.