-
|
Hello maintainers! I’m using go-taskflow to manage concurrency for a mix of tasks:
Does the library provide a way to hint or explicitly categorize tasks as either I/O-bound or compute-bound? For example:
I’d appreciate guidance on best practices for optimizing task execution based on type. Thank you! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
|
For now, this repo doesn't try to optimize executions of CPU-bound tasks. The biggest reason is that, in golang, goroutines are arranged over GPM models, which means task scheduling is not transparent to upper-layer developers. Tasks may be executed among multiple physical threads, and we cannot control their scheduling and execution, making optimization much harder. So for now, the framework treats both kinds of tasks in the same way. The A simple optimization would be setting executor's concurrency and GOMAXPROCS to CPU CORES, making task cache friendly. |
Beta Was this translation helpful? Give feedback.
For now, this repo doesn't try to optimize executions of CPU-bound tasks.
The biggest reason is that, in golang, goroutines are arranged over GPM models, which means task scheduling is not transparent to upper-layer developers. Tasks may be executed among multiple physical threads, and we cannot control their scheduling and execution, making optimization much harder.
So for now, the framework treats both kinds of tasks in the same way. The
copoolindeed tries to reduce goroutine overhead in a general way, but does not optimize them separately.A simple optimization would be setting executor's concurrency and GOMAXPROCS to CPU CORES, making task cache friendly.