[英]Having more than one client per thread in c10k
Is there any optimal reason why one thread per client is normally used in the c10k problem? 在c10k问题中为什么每个客户端通常使用一个线程有最佳的理由吗?
Can we put 5, 10, or 25 per thread? 我们可以在每个线程上放置5、10或25吗? Would there be any negative changes to performance? 绩效会有负面变化吗?
Having one thread per client seems to be very taxing on the system and if we had 25 per thread we could have 400 threads for 10,000 instead of 10,000 for 10,000. 每个客户端只有一个线程似乎对系统造成了很大的负担,如果每个线程只有25个线程,那么我们可以有400个线程(10,000个)而不是10,000个(10,000个)。
There are two completely different models for dealing with 10K+ connections: 有两种完全不同的模型来处理10K +连接:
Both models can be used to work with more than 100K connections, and both models have their benefits in certain areas. 两种型号均可用于超过100K的连接,并且两种型号在某些领域都有其优势。 In direct comparison, they differ as follows: 直接比较,它们之间的区别如下:
Multi-Threaded: 多线程:
Single-Threaded: 单线程:
It is possible to combine these two models. 可以将这两种模型结合起来。 In this case, one thread per core is typically used (instead of one thread for N connections). 在这种情况下,通常每个核心使用一个线程(而不是用于N个连接的一个线程)。 There are some good use cases for this model. 此模型有一些很好的用例。 However, there is also a huge problem: It combines the drawbacks of both models. 但是,还有一个巨大的问题:结合了两种模型的缺点。 That means, you have to spent the efforts to everything thread-safe , non-blocking and asynchronous . 这意味着,您必须花所有精力在线程安全 , 非阻塞和异步上 。 Usually the effort is twice as high as for one of the pure models. 通常,工作量是纯模型之一的两倍。
That's the reason, why the pure models are usually preferred over the mixed model for most applications. 这就是为什么对于大多数应用而言, 纯模型通常比混合模型更受青睐。 The exceptions are edge components , which have to deal with millions of requests per second, eg load-balancers and proxies. 边缘组件例外,它们必须每秒处理数百万个请求,例如负载平衡器和代理。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.