单例对象(远程处理)的可扩展性问题
单例对象的可扩展性问题
大家好,
我们有一个托管在 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
始终只有 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.