Exploring Swoole features
Swoole has a lot of features that we can use in the Laravel Octane application in order to improve the performance and speed of our application. In this chapter, we are going to explore these functionalities and then in the subsequent chapters, we will use these functionalities. The Swoole functionalities that we are going to explore are as follows:
- Concurrent tasks
- Interval command execution
- Caching
- Tables
- Metrics
Concurrent tasks
With Swoole, it is possible to execute multiple tasks in parallel. To demonstrate this, we are going to implement two functions whose execution takes some time.
To simulate the fact that these two functions are time-consuming, we will use the sleep()
function, which suspends execution for a certain number of seconds.
These two functions return strings: the first one returns “Hello
” and the second one returns “World
”.
We are going to set the execution time to...