Closed lizhichao closed 3 years ago
@sy-records @huangzhhui @leocavalcante @luoxiaojun1992 could help decide which configuration to use for enable_coroutine
@lizhichao thanks for you catch-up
Not sure, but I think that this set to false makes the request handler work on the main process instead of on a separate coroutine. I'd suggest to set this to true (removing this setting), it will probably speed up the results (my guess).
Worth to note, that neither Swoole, Simps nor Hyperf disables this at TechEmpower's benchmarks.
We used Simps as a template for Siler, so it inherited the setting, but, at least for Siler, there is no good reason for it.
@leocavalcante You didn't understand the role of this config. 😅
@sy-records I didn't 😄 What it really does?
The default value of enable_coroutine
is true
. And the task_enable_coroutine
is a different config item.
Not all cases use coroutines can improve performance.
Not all cases use coroutines can improve performance.
Why is that? Can you brief a little please? For our knowledge.
And, so the setting does indeed makes each request run on a coroutine instead of the main process?
Thanks @luoxiaojun1992 for notice, I've re-introduce the removed item
What is the main pros/cons about having a non default enable_coroutine
(false) ?
The idea is to standardize this config for all swoole
base frameworks
I think the coroutine is useful in an api which includes I/O operation. For example, querying database or calling another api.
@waghanza The base configuration I recommend is this.
'worker_num' => swoole_cpu_num() * 2,
'enable_coroutine' => false,
@leocavalcante The role of enable_coroutine
may not be clearly described in the English documentation, so I'll roughly describe it here.
The default value of enable_coroutine
is true
, Take Swoole\Http\Server
as an example.
enable_coroutine
is set to true
, Swoole automatically creates a coroutine in the onRequest
callback.I think the coroutine is useful in an api which includes I/O operation. For example, querying database or calling another api.
He's right, no IO operations such as databases are used in this project, so there is no need to use coroutine.
@sy-records thank you very much for the explanation.
enable_coroutine
There is no need to unify this configuration value, different values can be set for different scenarios
@huangzhhui to ensure results accuracy, and a as fair as possible, comparison we SHOULD have the same configuration.
I'm in favour of what is used in production, even if it decrease performances (i.e -> enable_coroutine = true since most applications in production use a database)
The purpose is to have results that can be close (as close as possible) the real life
@huangzhhui to ensure results accuracy, and a as fair as possible, comparison we SHOULD have the same configuration.
I'm in favour of what is used in production, even if it decrease performances (i.e -> enable_coroutine = true since most applications in production use a database)
The purpose is to have results that can be close (as close as possible) the real life
Agree, but actually, the results of this project does not including the tests has I/O requests, so this configuration will not affect the performance results, it does not matter what value it is.
Agree, but actually, the results of this project does not including the tests has I/O requests, so this configuration will not affect the performance results, it does not matter what value it is.
:ok_hand: so I suggest to leave the default.
Why ?
The idea, as you mention, is that this option (on the non default) could affect only IO operations. So no variation due to that here
. :heart:
However, leaving the default option has 3 advantages :
lean
code)flexible
for us)inspiration
Please vote :+1: to use the default and :-1: to set false
I leave this issue open since 19th of June, and I will act according to the vote
precision :
swoole
decide)@leocavalcante the vote in in https://github.com/the-benchmarker/web-frameworks/pull/2920#issuecomment-642449138
@Yurunsoft enable_coroutine
swoole option seems to be unavailable with imi. I have 404
if I add enable_coroutine => false
in mainServer.configs
Modify configuration information