panjf2000 / gnet

🚀 gnet is a high-performance, lightweight, non-blocking, event-driven networking framework written in pure Go.
https://gnet.host
Apache License 2.0
9.68k stars 1.04k forks source link

用taskset把程序绑定到多核心以后,性能不如taskset绑定到单核心 #433

Closed huangmingyou closed 1 month ago

huangmingyou commented 1 year ago

Questions with details

本来的计划是在机器上隔离出单独的cpu给应用使用。 但是用taskset绑定多核心以后,性能反而不如在单核心上面好。multicore 这个参数有什么设置技巧吗?

Code snippets (optional)

No response

panjf2000 commented 1 year ago

你的业务场景是不是单核心就足够了,设置多核心反而因为上下文切换而降低了性能?

huangmingyou commented 1 year ago

单核心不太够用,还是希望能多核心运行。同样的配置,如果不使用 cpuset或者taskset做cpu绑定,性能会比作了cpu绑定好。是否是cpu绑定会影响到gnet的性能。

panjf2000 commented 1 year ago

你绑了多少个 CPU 到进程上?

然后你说不设置 option.multicore 和 option.NumEventLoop 性能更好?

huangmingyou commented 1 year ago

通过cgroup方式绑定到了两颗cpu , 对,把multicore=false,性能更好。

panjf2000 commented 1 year ago

你能提供一下复现步骤吗?最好是有 demo 代码可以测试。

github-actions[bot] commented 1 month ago

This issue is marked as stale because it has been open for 30 days with no activity.

You should take one of the following actions:

This issue will be automatically closed in 7 days if no further activity occurs.

github-actions[bot] commented 1 month ago

This issue was closed because it has been inactive for 7 days since being marked as stale.

If you believe this is a false alarm, please leave a comment for it or open a new issue, you can also reopen this issue directly if you have permission.