Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

为libuv增加多线程是不是很有意义的一件事呢, #13

Open
ganshiqingyuan opened this issue Apr 8, 2021 · 7 comments
Open

Comments

@ganshiqingyuan
Copy link

redis6 最近也新增了多线程处理网络io的功能呢,性能提升了一倍左右,,多线程处理网络文件io貌似已经成为高性能库的标配了,而libuv已经很久没更新了

@XadillaX
Copy link
Owner

为什么你会觉得 libuv 没有多线程呢?

@ganshiqingyuan
Copy link
Author

为什么你会觉得 libuv 没有多线程呢?

libuv的多线程不是文件的io吗,我是说处理网络协议那块,类似redis6

@XadillaX
Copy link
Owner

XadillaX commented Jan 5, 2022

IO 都在 epoll / kqueue 里面的。至于其它的内容,因为 JavaScript 本身是单线程的,但凡用 JavaScript 写的代码都是要在一个线程里。Node.js 现在的 worker_thread 也就还是个玩具,Bug 一堆。另外,就算用 worker_thead,其实是不同的 V8 Isolate,这里面的开销也不小。

@ganshiqingyuan
Copy link
Author

IO 都在 epoll / kqueue 里面的。至于其它的内容,因为 JavaScript 本身是单线程的,但凡用 JavaScript 写的代码都是要在一个线程里。Node.js 现在的 worker_thread 也就还是个玩具,Bug 一堆。另外,就算用 worker_thead,其实是不同的 V8 Isolate,这里面的开销也不小。

我的意思是修改libuv,为他加入多线程支持,他不是c写的吗,,类似于redis6,以及netty等等的做法,,

@XadillaX
Copy link
Owner

libuv 本来就有多线程的 API 呀。

@ganshiqingyuan
Copy link
Author

libuv 本来就有多线程的 API 呀。

参考redis6

@XadillaX
Copy link
Owner

你指的是 multi-reactor 模式,这个可以把 Issue 提到 libuv 的仓库下。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants