Closed hirrolot closed 5 years ago
we have too kind of threads that are running the scheduler of coroutines. one kind is for only IO APIs e.g. TCP/UDP stream one kind is for timer/sync primitives API e.g. Mutex, Sleep
so the APIs are used to set the thread number of the corresponding schedulers.
you can ref https://xudong-huang.github.io/stackful_coroutine_story.html#/ about the arch
set_pool_capacity
is an optimization when you create/destroy coroutines. the underlying coroutine stack memory could be reused. so you don't have to alloc and free the stack whenever you create a coroutine. there is pool that manage the resources. When you set the pool size to 1000, the first 1000 coroutine will not alloc stack from sysmem, but reuse from the pool.
Thanks
I see three methods on the
Config
type:set_io_workers
,set_workers
, andset_pool_capacity
.What is the difference between them and what do they mean?