Home >PHP Framework >Swoole >Why is swoole better than php?
Directly apply the introduction on Swoole's official website:
PHP's asynchronous, parallel, high-performance network communication engine, written in pure C language, provides PHP language asynchronous multi-threaded server, asynchronous TCP/UDP network client, asynchronous MySQL, asynchronous Redis, database connection pool, AsyncTask, message queue, millisecond timer, asynchronous file reading and writing, asynchronous DNS query.
Swoole has built-in Http/WebSocket server/client and Http2.0 server. (Recommended learning: swoole video tutorial)
Why does PHP need to supplement swoole
## Compared with apache/fpm, the swoole framework mainly saves The performance loss caused by the creation and destruction of each request of the PHP framework and global objects.
The swoole framework provides programmers with the greatest space, and global objects unrelated to http requests only need to be constructed once. Cache control of certain objects and data can also be performed in the program.
PHP is the best language. Swoole has redefined the best language. This is of course a joke. However, PHP is a language with low entry-level, fast development and high execution efficiency. In the era of PC Internet, which is famous for its speed, it has become the undisputed first choice. This is the advantage of PHP. Then the advantage slowly transformed into a mindset. In the eyes of many engineers, PHP development is equivalent to web development. However, now is the era of mobile Internet, the Internet of Things, and smart hardware are also booming. It seems PHP is not so popular anymore (ps: it has always been the case), and the emergence of swoole has successfully broken through this mindset, allowing PHP to jump out of web development. has entered the larger field of server network programming, but web development and server network programming are still very different in development thinking. This series of articles will help everyone make thinking changes through the introduction of swoole, so as to Enter a new world.The relationship between PHP and SWOOLE
Swoole is an extension of PHP, developed purely in C, mainly to supplement PHP's deficiencies in network programmingThe operating modes of PHP and SWOOLE
php is the host of swoole, so it is essential to understand the operating mode of php itself. The picture below is when executing a php file under cli The complete process #The upper layer has the concept of SAPI. SAPI is a unified interface provided by PHP to allow the external environment to execute the PHP kernel. Our three common SAPIs are cli , php-fpm, mod_php.The above is the detailed content of Why is swoole better than php?. For more information, please follow other related articles on the PHP Chinese website!