目前我不确定,我尝试制作高性能服务器,我有一个 6Core CPU,所以如果我使用io_service_per_cpu"设计,我有 6 个 io_service.
Currently Im not sure, I try to make a high-performance server, I got a 6Core CPU, so if I would use the "io_service_per_cpu" design, I have 6 io_services.
我已经听说线程池设计不是最好的,但我不确定.
I already heard that the threadpool design isnt the best one, but Im not sure about that.
你有什么知识?有人已经对每个人进行了压力测试,还是其他什么?
What knowledge do you have? Someone already made a Stress test with each, or something else?
根据我的经验,按照以下顺序进行异步应用程序设计要容易得多:
In my experience it is vastly easier to approach asynchronous application design with the following order:
io_service
io_service
调用 io_service::run()
.使用 strands 作为处理程序需要访问共享数据结构.io_service
每个 cpuio_service
io_service::run()
from a single io_service
. Use strands for handlers that require access to shared data structures.io_service
per cpu在对您的应用程序进行概要分析之后,应该考虑在这些设计中的每一个之间进行更改.请注意,仅 HTTP Server 2 示例展示了如何使用每个 CPU 的 io_service
,它没有告诉你何时或为什么使用这样的设计.
The motivation for changing between each of these designs should be done after profiling your application. Note that the HTTP Server 2 example only shows how to use an io_service
per CPU, it does not show you when or why to use such a design.
这篇关于boost::asio 线程池与 io_service_per_cpu 设计的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!