简体   繁体   English

我可以拥有多少个命名管道?

[英]How many named pipes can I have?

No one answers me correctly or with an official resource to this matter. 没有人正确地回答我,或没有提供官方资源来回答这一问题。 I have a server and many modules. 我有一台服务器和许多模块。 Each module will create a named pipe and the server will create one named pipe per module. 每个模块将创建一个命名管道,而服务器将为每个模块创建一个命名管道。 I need to know how many named pipes can I have at the same time. 我需要知道我可以同时拥有几个命名管道。

I'm not planning on connecting them like 10 clients to 1 server, no. 我不打算将它们像10个客户端连接到1个服务器,不。 I want to connect 1 client to 1 server always, but how many of this pipes can I make? 我想始终将1个客户端连接到1个服务器,但是我可以制造多少个管道?

Note that I'm using WCF in C#. 请注意,我在C#中使用WCF。

Each named pipe created in Windows uses some system resources, which means there is a practical limit on the number of pipes which can be created. Windows中创建的每个命名管道都使用一些系统资源,这意味着可以创建的管道数量受到实际限制。 See: 看到:

Every time a named pipe is created, the system creates the inbound and/or outbound buffers using nonpaged pool, which is the physical memory used by the kernel. 每次创建命名管道时,系统都会使用非页面缓冲池(即内核使用的物理内存)创建入站和/或出站缓冲区。 The number of pipe instances (as well as objects such as threads and processes) that you can create is limited by the available nonpaged pool. 可以创建的管道实例(以及诸如线程和进程之类的对象)的数量受到可用的非页面缓冲池的限制。

The exact numerical limit will depend on your system, but it is likely to be at least in the order of hundreds if not thousands. 确切的数值限制将取决于您的系统,但可能至少约为数百(如果不是数千)。

When the pipes are being created using the WCF Named Pipe Binding, you can only create one pipe per base address, due to the way in which this binding publishes metadata about the pipe being used. 使用WCF命名管道绑定创建管道时,由于该绑定发布有关正在使用的管道的元数据的方式,每个基地址只能创建一个管道。 It is therefore best to define WCF endpoints using absolute URI addresses rather than base address + relative. 因此,最好使用绝对URI地址而不是基地址+相对地址来定义WCF端点。 Provided you do this, and design a reasonable scheme for creating a unique absolute address for each endpoint, there is no fixed limit that I know of to the number of WCF endpoints you can create. 如果您这样做,并且设计了一个合理的方案为每个端点创建唯一的绝对地址,那么我对可以创建的WCF端点的数目没有固定的限制。

The actual practical limit on any particular system can only be discovered empirically. 任何特定系统的实际实际限制只能凭经验发现。 If your goal is to have a few tens of endpoints, I would guess that you will be able to achieve this comfortably. 如果您的目标是拥有几十个端点,那么我想您将能够轻松实现这一目标。 If you want to have thousands operating concurrently you may bring the practical limit of system resources into play. 如果要同时运行数千个,则可以发挥实际的系统资源限制。 Only testing will determine this for sure. 只有测试才能确定这一点。

First I wanted to tell you that you should explain the Question properly, otherwise no one will help you here. 首先,我想告诉您,您应该正确解释问题,否则没人会在这里帮助您。 Explain where is the problem you faced and show us some code also. 向您解释您在哪里遇到的问题,并向我们展示一些代码。

From your explanation, i found that what you want is this : Number of Clients that can connect to a Named Pipe . 从您的解释中,我发现您想要的是: 可以连接到命名管道的客户端数量

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM