Home >Backend Development >PHP Tutorial >Look! The good thing 'Roadrunner' that can speed up PHP programs is here!
The Laravel Octane package (https://github.com/laravel/octane) was recently released. It was created to make Laravel more Swoole and RoadRunner friendly. We have been using RoadRunner instead of php-fpm in dev.family for some time and we decided to share our experience and reveal what advantages it has.
RoadRunner is a high-performance, open source PHP application server written in Go. The main difference with php-fpm is that RoadRunner interacts with the resident process of php, unlike php-fpm, which creates and kills a new php process on each request. [Recommended: PHP Video Tutorial]
Advantages of resident processes:
The disadvantage of this approach is that it is not suitable for all PHP applications , because code is usually written with the thought that the PHP process will terminate after the request. Therefore, you need to be able to monitor memory leaks and handle global state carefully. Therefore, legacy projects may not be launched on Roadrunner.
However, Roadrunner has other useful features, such as static feedback, response compression, and balancing. The functionality of a typical bundle falls on nginx. If you are using PHP Roadrunner, you can launch the application (nginx) without it.
RoadRunner is also easily extensible. You can use its components for your own application server and get the opportunity, for example, to handle some requests directly on Go using websockets.
RoadRunner itself is not a new development, it is already a few years old. However, with official support for Laravel Octane, you can be sure that the framework is ready to use it.
We did a small test on a real project to compare the speed of php-fpm and roadrunner. The results are as follows:
php-fpm:
plain text: 1150 RPS
single query: 530 RPS
roadrunner:
plain text: 2200 RPS
single query: 1600 RPS
plain text -- Query that returns constant JSON
single query -- Will Query
that returns the results of a single query to the database in JSON format is significantly faster due to the lack of startup time and the use of a permanent connection to the database.
Original address: https://dev.to/dev_family/roadrunner-here-and-now-2oo9
Translation address: https://learnku.com/php/ t/61447
The above is the detailed content of Look! The good thing 'Roadrunner' that can speed up PHP programs is here!. For more information, please follow other related articles on the PHP Chinese website!