Can swoole be used in the business logic of Synchronize?

the swoole protocol can achieve the performance of asynchronous IO, but compared with asynchronous IO and multithreading, swoole protocol is implemented in Synchronize encoding rather than callback.
< H2 > question: < / H2 >

if the current business logic is Synchronize ( for example: first query Mysql to obtain the ID, of a record, and then query a record of redis based on this ID ), can it be implemented using swoole protocol?

PS:

swooleIOIO
Mar.09,2021

Yes, the business logic of Synchronize and the IO executed asynchronously are not conflicting.

but it is actually similar to asynchronous IO concurrent execution

in the same business logic, IO with data dependency will not be executed concurrently, but IO without data dependency in different business logic will be executed concurrently.

for example:

first query Mysql to get the ID, of a record, and then query a record of redis based on this ID

you must first check Mysql and then Redis, but when multiple such requests are processed concurrently, multiple Mysql queries and multiple Redis can be concurrent.


there are asynchronous and Synchronize already. The ordinary one is Synchronize, unless you call the asynchronous interface


Synchronize code will block Worker,. The benefit will only be persistence, while the protocol uses asynchronous IO, that will not block Worker

.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b31717-2bd90.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b31717-2bd90.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?