One Web Request Processed by two Worker Process - web

I am configuring a web garden in IIS server.
I know that the web garden will have more than once worker process for a application pool, which mean that extra w3wp.exe can get created for one web application once it's number of requests exceeds the limit. (Please correct me if i am wrong)
From the above case , is there a possibility for one request is being processed by more than one w3wp.exe ?
and also need clarity on whether two w3wp.exe will be created for single application? or two w3wp.exe will share the applications in an app pool.

From the above case , is there a possibility for one request is being processed by more than one w3wp.exe ?
No, each request is assigned to one and only one worker process.
whether two w3wp.exe will be created for single application? or two w3wp.exe will share the applications in an app pool.
Two (or more) worker processes will be created for the application pool. Inside the pool you can have multiple applications or App-Domains in Dot.net terms. If you have multiple applications in the pool, requests for each application are distributed among the processes. So with two applications and two W3wps you can't tell which w3sp processes the request for a specific application.

Related

Migrate monolitich application with long running reference

i have a web application (asp.net 4.5) deployed over IIS in 3 different virtual machines. From the UI you can enqueue long running jobs with a duration between 1 and 10 hours and this process can't be easilly split (i use Hangfire per manage these jobs) and users can check status of jobs from UI. There are multiple Db with same schema split by group of users. As storage it uses a shared drive (about 40TB of stuff)
In this scenario, what about migrate all on Azure with microservices architetture?
I was thinking to keep the Hangfire component to manage long jobs/recurring operations and have a react frontend that call one/more api microseevices to get info and enqueue jobs.
About database worth it split consider that is already "balanced" by group of users? I was also thinking to use cqrs pattern with a readonly Db populated with service bus messages, but i'm not sure about the advantages...
How do you Will migrate to cloud similar type of application?

Can we have a worker Role and a web role in a single instance of Azure Cloud Services

I am just about to move my website, database and a background scheduler onto the Azure platform.
I've to use cloud services with web & worker role. Now my question is that do I need separate instances for each type of role, or one instance is capable of hosting multiple types of role ?
You cannot have a combined web and worker role instance. It can be one or the other. However, it is possible to have the web role do background processing, so it can host the background workload.
See this SO question for a couple of options
Azure WebRole Scheduled Task Every Morning
That talks about running a task each morning. Obviously you can do it more frequently, as appropriate for your application.
Be aware of the scalability limitations of this though. Once your traffic ramps up, it will make sense to break it out into separate web and worker roles.
In fact, even if your background workload is light, it might still make more sense for you to go for a separate architecture from the start and use XS instances for the background processing.
Technically you can't have a role of both types. Yet a web role is just the same as a worker role, it just has IIS configured. So you can merge them into one web role - IIS will run in a separate process and role entry point Run() will run some endless loop for "backend" processing. See this similar question.
This will make scaling more complicated. The whole idea of separate roles (remember you can have not only one web role and one worker role, you can have for example four worker roles and two web roles if that's appropriate for your solution) is that you can scale them separately.
It looks like once you merge two roles into one you no longer can fine scale them. This is not true most of the time - you just have to change metrics.
For example, you wanted to run one web role instance for each thousand HTTP requests per minute and one worker role instance for each ten requests in the backend queue. Okay, this means that each thousand HTTP requests needs the same amount of processing power as ten items in the backend queue. So you craft a new metric that takes both parameters and deduces a number of instances. Like you have five thousand requests per minute and twenty requests in the backend queue - you need seven instances of am merged role.
This won't work for all applications, but most of them will use this approach just fine. The bonus is that you avoid cases when either of the roles in idling because the current load gets onto another role.

WebSphere Thread Management

I was looking for configure the thread pool by application instead of profile. Basically, to avoid the unavailability of threads for most important application that share the profile with application that can run in background.
Is there any configuration thread pools by application instead of profile?
The best would be to use a dedicated thread pool for the critical application.
However in order to achieve that you need to use a separate host-port combination for that particular application.
That is because a web threads pool is associated with a web container transport chain and a transport chain is determined by a host-port pair.

Multiple roles on the same instance in Windows Azure

Is it possible to deploy multiple roles in the same instance?
I have three web roles (website in asp.net mvc3, and two WCF services instances) and two worker roles (windows services).
The load for this application is very small, so I don't want to create so many instances in Windows Azure and pay for all of the instances now. Instead I want to deploy all my application in the same instance and change it later if I will get some income from my applications.
I Googled and found some forum posts than it's possible and some than it's not possible... but I can't find information how to do it...
So two questions:
Is it possible?
How can I do it?
A slightly different answer than #Simon's... A Role is actually a template for a Windows Server 2008 VM (see my answer on this SO question as well). Each role has one or more instances, and you can run whatever you want on any role.
You can absolutely run your website and all your WCF services in a single role. You'll now scale your application up/down (VM size) and out/in (# of instances) as a single scale unit. If, say, your WCF services are CPU-intensive, causing the VM instances to slow down for your web visitors, you'll need to scale out enough to handle those visitors.
Once you reach a significant traffic load, it's worth considering separate roles. That way, you can decide on VM size and quantity per role. Maybe you have 2 or 3 Small instances of a Web role to handle your user traffic on the website, and maybe 2 Medium instances of a Worker role to handle WCF services (just as an example). The more roles you have, the finer-grain scaling you have, but you must run at least one instance of each role, which elevates your "system at rest" baseline cost.
No, roles are instances and each one takes up an entire VM. You can however deploy a number of websites into a single role, which will allow you to deploy all your MVC and WCF apps into a single web role. You need to add websites to the sites element in the ServiceDefinition. There seem to be a few blog posts on how this is done - here and here.
For worker roles, I suggest you create a single worker role and combine the work done in those roles, such as starting a separate thread for each queue being monitored. This StackOverflow answer by Eugenio Pace.
I wouldn't recommend trying to combine worker role functionality into the web role. Apart from it not making architectural sense, sense to the physical infrastructure (IIS vs not IIS), there are potential issues such as the with termination of running threads when worker roles recycle (a thread not started by IIS may terminate abruptly)
Check this episode of cloud cover.
you can put couple of web role in the same instance.
worker role you can always put multiple thread to work the data.
http://channel9.msdn.com/Shows/Cloud+Cover/Cloud-Cover-Episode-37-Multiple-Websites-in-a-Web-Role.
Note that each time you upload a new version to azure you need to upload all the web roles/ worker roles to azure again
Check out this blog post 'Combining Multiple Azure Worker Roles into an Azure Web Role'
http://www.31a2ba2a-b718-11dc-8314-0800200c9a66.com/2012/02/combining-multiple-azure-worker-roles.html
I think this is what you need to do...
Also Wayne has variations of this on his blog: http://www.31a2ba2a-b718-11dc-8314-0800200c9a66.com/2010/12/how-to-combine-worker-and-web-role-in.html
HTH

web + worker role cost

I have to run a web crawler in background using Azure.
According to what I understood I have to setup a worker role configured with the background task and I have to setup a web role to show the web site ASP.NET MVC.
A simple question: how does it work for the payment? Two different roles means two different instances? Or I can reuse the same instance hosting two different roles?
Each Role you define must contain 1 or more instances. Each instance is a VM and you will be billed currently .12/hr per CPU core (or fraction thereof for XS roles).
You can combine the web site with worker role capabilities very easily. By default, you should see a WebRole.cs that implements a RoleEntryPoint. That is your worker role entry point in a web role. You can combine whatever logic you want in there for the background task.

Resources