Closed tricarte closed 5 months ago
Hi @tricarte
When enable_coroutine is false, the framework speed is increased
To establish a connection with the database, I suggest you to use the DB class. With this class, you can have speed in addition to the simplicity of working with the database.
Thank you dear friend
I've created two simple services based on raw PDO class just for test purposes. One of them is using the connection pool and the difference of queries per second between the two are enormous. Connection pool perfroms 17K requests and the other one is around 10.1K.
There is not much difference when using the DB class with or without enable_coroutine
: 9.5K (false) vs 9.3K (true). I guess that class does not utilize pooling and if it did, maybe it would perform a lot better. But this is not something I really consider. The framework performs already really well. But, IMO, enable_coroutine
should be something that can be set using env files or through the server.php
config file.
You can manually set enable_coroutine to true to test through the following file to see the difference in speed.
https://github.com/fomo-framework/framework/blob/master/src/Servers/Http/server
In
.vendor/fomo/framework/src/Servers/Http.php
, I see thatenable_coroutine
is hardcoded to false. Is there a reason for this?I'm trying to use the PDO connection pool feature of Swoole and it depends on that setting being set to true. Without it, I'm getting this error:
API must be called in the coroutine in @swoole/library/core/ConnectionPool.php:67
. Maybe, I'm doing something wrong.Also thanks for this framework.