单例对象(远程处理)的可扩展性问题

发布于 2024-09-09 08:52:22 字数 964 浏览 3 评论 0原文

单例对象的可扩展性问题

大家好,

我们有一个托管在 Windows 服务中的单例对象。 它工作得很好,直到同时客户端请求的数量超过 100 左右的某个神奇数字。 此后,仅当当前连接之一被释放时,所有新调用似乎才会一一排队和处理。

如果有人能告诉我们如何摆脱这个限制,我们将不胜感激。

当发生这种情况时,线程数量(根据任务管理器)约为 120 个,因此线程池不应该成为问题(如果我理解正确的话,有 2 个 CPU 最多可构成 512 个线程)。 还有大量的可用内存(进程分配了大约200-300 MB,仍然有超过1GB的可用内存)

我们使用.Net Framework 3.5

下面是app.config的片段。

    <configuration>
  <system.runtime.remoting>
    <application>
      <service>
        <wellknown type="CompanyName.Server.ServerStub, MyServer" objectUri="MyServer" mode="Singleton"/>
      </service>
      <channels>
        <channel port="3210" ref="tcp">
          <serverProviders>
            <formatter ref="binary" typeFilterLevel="Full"/>
          </serverProviders>
        </channel>
      </channels>
    </application>
  </system.runtime.remoting>
</configuration>

Scalability issue with singleton object

Hi All,

We have a singleton object hosted in windows service.
It works fine untill the number of simultaneous client requests exceeds some magical number around 100.
After this all new calls seems to be queued and processed one by one only when one of current connections is released.

We would very much appreciate if someone could tell us how to get rid of this limitation.

At the time when it happens the number of threads (according to Task Manager) is about 120 so thread pooling shouldn’t be an issue (there are 2 CPUs which makes up to 512 threads, if I correctly understand).
There is also plenty of free memory (the process allocates about 200-300 MB and there is still more than 1GB of free memory)

We use .Net framework 3.5

Below is fragment of app.config.

    <configuration>
  <system.runtime.remoting>
    <application>
      <service>
        <wellknown type="CompanyName.Server.ServerStub, MyServer" objectUri="MyServer" mode="Singleton"/>
      </service>
      <channels>
        <channel port="3210" ref="tcp">
          <serverProviders>
            <formatter ref="binary" typeFilterLevel="Full"/>
          </serverProviders>
        </channel>
      </channels>
    </application>
  </system.runtime.remoting>
</configuration>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

南街九尾狐 2024-09-16 08:52:22

始终只有 1 个单例对象。它一一处理所有请求。在大约 100 个请求之后,您可能会注意到一些速度变慢,因为一些缓冲区已满。

There always is only 1 singleton Object. Its handling all request one by one. After about 100 requests you'll probably notice some slowdown because some buffers are filling up.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文