ASP.NET Web Garden - 我需要多少个工作进程? [英] ASP.NET Web Garden - How Many Worker Processes Do I Need?

查看:18
本文介绍了ASP.NET Web Garden - 我需要多少个工作进程?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

决定允许 ASP.NET Web 应用程序使用多少工作进程的最佳实践是什么?

What is the best practice for deciding how many worker processes to allow for an ASP.NET web application?

在我管理的一台服务器上,创建一个新的 AppPool 默认为 10 个(最多)工作进程.其他人建议正常设置为一.

On one server I manage, creating a new AppPool defaults to 10 (maximum) worker processes. Other people suggest that the normal setting is one.

多个工作进程解决什么问题,决定多少的技术是什么?

What problem does multiple worker processes solve and what are the techniques for deciding on how many?

推荐答案

工作进程是一种跨多个 exe 分割网站执行的方法.你这样做有几个原因,一个是如果其中一个工作人员被运行时问题困扰,它不会让其他人失望.例如,如果传入的 html 请求导致进程一无所获,那么只有该工作处理器正在处理的其他请求会被杀死.另一个例子是,一个请求可能会导致由同一工作人员处理的其他线程阻塞.

Worker processes are a way of segmenting the execution of your website across multiple exe's. You do this for a couple of reasons, one if one of the workers gets clobbered by run time issues it doesn't take the others down. For example, if a html request comes in that causes the process to run off into nothing then only the other requests that are being handled by that one worker processor get killed. Another example is that one request could cause blocking against the other threads handled by the same worker.

至于你需要多少,做一些负载测试.用力点击应用程序,看看只有一个会发生什么.然后再添加一些并再次击中它.在某个时候,您将达到真正使机器网络、磁盘、CPU 和内存饱和的程度.那时你就知道你有正确的平衡.

As far as how many you need, do some load testing. Hit the app hard and see what happens with only one. Then add some more to it and hit it again. At some point you'll reach a point of truly saturating the machines network, disk, cpu, and ram. That's when you know you have the right balance.

顺便说一下,您可以通过 machine.config 文件控制每个工作进程使用的线程数.我认为关键是 maxWorkerThreads.

Incidentally, you can control the number of threads used per worker process via the machine.config file. I believe the key is maxWorkerThreads.

现在,请注意,如果您使用会话,会话状态不会在工作进程之间共享.无论如何,我通常建议避免会话,但这是需要考虑的.

Now, beware, if you use session, Session state is not shared between worker processes. I generally recommend avoiding session anyway but it is something to consider.

出于所有意图和目的,您可能会将每个工作进程视为自己独立的 Web 服务器.除了它们在同一个机器上运行.

For all intents and purposes you might consider each worker process as it's own separate web server. Except they are running on the same box.

这篇关于ASP.NET Web Garden - 我需要多少个工作进程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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