the-benchmarker / web-frameworks

Which is the fastest web framework?
MIT License
6.91k stars 641 forks source link

Modify configuration information #2920

Closed lizhichao closed 3 years ago

lizhichao commented 3 years ago

Modify configuration information

waghanza commented 3 years ago

@sy-records @huangzhhui @leocavalcante @luoxiaojun1992 could help decide which configuration to use for enable_coroutine

@lizhichao thanks for you catch-up

leocavalcante commented 3 years ago

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.

sy-records commented 3 years ago

@leocavalcante You didn't understand the role of this config. 😅

leocavalcante commented 3 years ago

@sy-records I didn't 😄 What it really does?

luoxiaojun1992 commented 3 years ago

The default value of enable_coroutine is true. And the task_enable_coroutine is a different config item.

sy-records commented 3 years ago

Not all cases use coroutines can improve performance.

leocavalcante commented 3 years ago

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?

waghanza commented 3 years ago

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

luoxiaojun1992 commented 3 years ago

I think the coroutine is useful in an api which includes I/O operation. For example, querying database or calling another api.

sy-records commented 3 years ago

@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.

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.

leocavalcante commented 3 years ago

@sy-records thank you very much for the explanation.

huangzhhui commented 3 years ago

enable_coroutine

There is no need to unify this configuration value, different values can be set for different scenarios

waghanza commented 3 years ago

@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 commented 3 years ago

@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.

waghanza commented 3 years ago

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 :

Please vote :+1: to use the default and :-1: to set false

waghanza commented 3 years ago

I leave this issue open since 19th of June, and I will act according to the vote

precision :

waghanza commented 3 years ago

@leocavalcante the vote in in https://github.com/the-benchmarker/web-frameworks/pull/2920#issuecomment-642449138

waghanza commented 3 years ago

@Yurunsoft enable_coroutine swoole option seems to be unavailable with imi. I have 404 if I add enable_coroutine => false in mainServer.configs