-
Notifications
You must be signed in to change notification settings - Fork 7
About thread pool #140
Comments
Not at the moment. I created libuv/libuv#382 but it ended up not getting merged. One big problem with auto-scaling is that a common setup for libuv programs is multiple processes, each with its own thread pool. In that configuration it's impossible to heuristically determine the optimal thread pool size.
Not a super clear question but I think you're looking for the
Unclear question. Let me invert that: why not not?
There isn't any. Portable file locking is pretty much impossible. http://0pointer.de/blog/projects/locking.html has a good overview of the problems. |
I have read the source code, and It looks like I can only use setenv to adjust it before thread initialization, and usually, we will determine the initial number of threads based on the number of CPU cores
many other languages have implemented scalable thread pools, in my opinion, their basic idea is
libuv always assumes that file IO is fast, but in fact it may block for quite a long time
uv_queue_work is regarded as CPU intensive operation, maybe sometimes I want to submit a slow IO operation?
sometimes we hope that: it can be difficult to use, but it cannot be absent 🥺 Thank you for your answer |
That's what I mean: with multi-process setups that ends up spawning With I/O-heavy workloads that might be okay (most threads will usually spend most of their time blocked in system calls) but it's almost certainly not what you want for CPU-intensive workloads. That's also why it's configurable through an environment variable and not programmatically: the system administrator or end user has a better, more holistic view of the optimal size than the application programmer. I'm not completely opposed to adding a programmatic API but when people requested that in the past it was always for the wrong reasons.
I think you're conflating language or runtime with library here. Libuv is a library, not a runtime.
Right, I understand what you mean but the current fast/slow I/O divide is a bit of a bandaid to fix thread starvation. It's not the final word on how libuv will handle that going forward and I don't think we want to expose that kind of implementation detail in the public API.
A fairly simple and robust approach is to have a secondary file that you create with How to implement fairness is left as an exercise to the reader. :-) |
the kernels of some languages are heavily rely on the libraries they use your answer is clear enough, thanks again for your help! |
questions:
uv__work_kind
to API?for heavy file IO, the golang kernel may open many threads to do it on runtime
![image](https://user-images.githubusercontent.com/55355227/79580507-a9ac2800-80fb-11ea-9189-9b4f3cd63716.png)
The text was updated successfully, but these errors were encountered: