IIS应用程序池,工作进程,应用程序域 [英] IIS app pools, worker processes, app domains

查看:185
本文介绍了IIS应用程序池,工作进程,应用程序域的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

谁能解释的差异,在IIS中,应用程序池,工作进程和应用程序域之间?此外,他们如何一起工作?我读了几篇文章,但它仍然是一个有点混乱。


  1. 是否在IIS中创建的每个网站变成了一个应用程序?

  2. 与一个工作进程相关联的每个应用程序?

  3. 在哪里应用程序域进入了吗?


解决方案

我试着说他们等字样。

在一台服务器,你可以有一个运行了众多asp.net网站。每一个网站是一个应用领域

您必须分配给每个其中之一的应用程序池。许多应用领域(网站)可以有相同的应用程序池,因为它们具有相同的应用程序池,他们相同的流程下运行,并在同一帐户下 - 他们有游泳池的相同的设置。如果这个池重新启动,然后在该池重新启动所有站点。

现在每个池都可以有一个或更多的工作进程即可。每个工作过程是这样的运行您的网站,有自己单独的静态变量不同的程序,它们不同的启动停止通话等不同的工作进程不在一起交流,并交换数据的唯一途径是从普通文件或一个共同的数据库。如果你有一个以上的工作进程,其中一人作很长的时间计算,那么其他可以照顾来处理互联网通话和显示的内容。

在很多工作进程分配到一个池,那么你做被叫的 Web园并您的网站就像是要从多台计算机上运行,​​如果一台计算机是一个处理机器。

每个工作进程可以有多个线程。

更多的工作进程如何影响你:结果
当你有一个工作进程一切更简单,你的应用程序中的所有静态变量都相同,并使用的 锁定 他们同步。结果
当您指定的多个工作进程,然后你还是继续使用锁定静态变量,静态变量都没有的很多运行中的不同您的网站,如果你有一些公共资源(如创建磁盘上的缩略图),那么你需要你的工作进程与同步<一个href=\"http://msdn.microsoft.com/en-us/library/system.threading.mutex.aspx\"><$c$c>Mutex.

还有一个注释。它的声音,当你做的更多的工作进程,然后你可能有更流畅的异步加载网页。有一个与asp.net的会话处理程序,它锁定整个过程中产生的页面加载一个小问题 - 这是好的和不好的依赖,如果你知道它,处理它 - 或改变它

因此​​,让我们谈谈唯一有许多工作进程的一个网站。在这里,你面对你需要同步与互斥您的公共资源变化的问题​​。但是,使用会话页面/处理他们不是异步因为会话锁定他们。这是很好的开始,因为你避免使多点的这种同步你的自我。

关于这个主题的一些问题:结果
<一href=\"http://stackoverflow.com/questions/9426673/web-app-blocked-while-processing-another-web-app-on-sharing-same-session\">Web应用程序被阻止在处理上共享同一个会话结果另一个Web应用程序
<一href=\"http://stackoverflow.com/questions/9052401/jquery-ajax-calls-to-web-service-seem-to-be-synchronous\">jQuery Ajax调用到Web服务似乎是同步结果
<一href=\"http://stackoverflow.com/questions/12284530/asp-net-server-does-not-process-pages-asynchronously\">ASP.NET服务器不处理页面异步结果
更换ASP.Net的会议完全

现在这个会话锁不会影响不同站点。

在不同的网站更多的方法加工的过​​程中可以帮助不是一个网站屏蔽了其他长运行的进程。结果
同时在不同站点之间的多个池也可以帮助,因为每个池至少有一个工作过程,但请记住,通过使用Process Explorer中你自己看,每个工作过程需要您的计算机的内存越多,和16G内存的一大服务器和一个SQL服务器不能有太多不同的方法加工的过​​程 - 例如与100共享网站的服务器上,你不能有100个不同的水池

Can anyone explain the differences, in IIS, between application pools, worker processes and app domains? Also, how do they work together? I've read a couple of articles but it's still a little confusing.

  1. Does each website created in IIS becomes an application?
  2. Is each application associated with one worker process?
  3. Where do app domains come into the picture?

解决方案

I try to say them with other words.

In a server you can have many asp.net sites that runs together. Each one site is an app domain.

You must assign to each of them one application pool. Many application domains (sites) can have the same application pool, and because they have the same application pool they run under the same processes, and under the same account - and they have the same settings of the pool. If this pool restarts, then all sites under that pools restarts.

Now each pool can have one or more worker process. Each worker process is a different program that's run your site, have their alone static variables, they different start stop calls etc. Different worker process are not communicate together, and the only way to exchange data is from common files or a common database. If you have more than one worker process and one of them make long time calculations, then the other can take care to handle the internet calls and show content.

When you assign many worker process to a single pool then you make the called web garden and your site is like to be run from more than one computer if a computer is one processing machine.

Each worker process can have many threads.

How the more worker process affect you:
When you have one worker process everything is more simple, among your application all static variables are the same, and you use the lock to synchronize them.
When you assign more than one worker process then you still continue to use the lock for static variables, static variables are not different among the many runs of your site, and if you have some common resource (e.g. the creation of a thumbnail on the disk) then you need to synchronize your worker process with Mutex.

One more note. Its sounds that when you make more worker process then you may have more smooth asynchronous page loads. There is a small issue with the session handler of asp.net that is lock the entire process for a page load - that is good and not good depend if you know it and handle it - or change it.

So let talk about one site only with many worker process. Here you face the issue that you need to synchronize your common resource change with Mutex. But the pages/handlers that use session they are not asynchronous because the session locks them. This is good for start because you avoid to make this synchronization of many points your self.

Some questions on this topic:
Web app blocked while processing another web app on sharing same session
jQuery Ajax calls to web service seem to be synchronous
ASP.NET Server does not process pages asynchronously
Replacing ASP.Net's session entirely

Now this session lock is not affect different sites.

Among different sites the more worked process can help to not the one site block the other with long running process.
Also among different sites the more pools also can help, because each pool have at least one worked process, but remember and see by your self using the process explorer, each working process takes more memory of your computer, and one big server with 16G memory and one SQL server can not have too many different worked process - for example on a server with 100 shared sites, you can not have 100 different pools.

这篇关于IIS应用程序池,工作进程,应用程序域的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆