Welcome Guest, Not a member yet? Register   Sign In
Long-living PHP support (Swoole/RoadRunner etc)
#5

(This post was last modified: 10-15-2022, 07:35 AM by monkenWu.)

Hi, I'm glad this topic is being discussed.

Since I developed the CodeIgniter4-RoadRunner library, I have been trying to get CodeIgniter4 to run on a high performance php server.

In my work, I use Laravel for development. But in my spare time or side projects, I've been using CodeIgniter4.

I know that Laravel has a library called Laravel-Octane which is a perfect combination of Open Swoole and RoadRunner high performance server.
Similarly, for CodeIgniter4, I wanted to build a similar library to make the framework more attractive.

So I started the CodeIgniter4-Burner project to try to make CodeIgniter4 support multiple high-performance servers in a single library.
Like the idea of CodeIgniter being easy to use, my goal is to make CodeIgniter4-Burner work out of the box.

I encountered some issues in the development of the library, which I briefly mention here.

1. Request and Response objects do not implement the psr-7 interface.
Although the objects can be reconverted in some way, these conversions may cause some unnecessary performance overhead.

2. Unexpected direct output.
Although CodeIgniter4 uses the concept of Response objects, it is often found that the response is directly "echo" or header() declared in non-Response classes.
In high performance php servers, http output is handled by psr-7 Response or its proprietary Response object, and CodeIgniter4's "echo" behavior not only pollutes the buffer, but may also make the server unstable (like RoadRunner is sensitive to this).

3. debug-bar is not well designed.
In CodeIgniter4 the debug-bar handling seems to be out of the normal flow, it has a completely separate Request processing and Response output, which makes me overwrite the Debug-Bar related Classes and understand its logic very deeply. and in many cases I prefer CodeIgniter4 to be a black box and I don't want to overwrite the Class Method unless necessary.

4. The file upload class does not work correctly.
In php, we use move_uploaded_file() for file uploads, and CodeIgniter4 does too. However, on these long-living php servers, move_uploaded_file() does not work properly (because it is not a temp file handled by php, so this method will always fail). If the storage logic could be adjusted, then there would be no need for an additional file upload interface (which is how I currently handle it).

Above, I've summarized some of the issues I've encountered in development.

I have also solved these problems to some extent in CodeIgniter4-Burner. Currently, the library can provide http service, REST API, SESSION, database reconnection and file upload.

In the meantime, we are developing and testing CodeIgniter4-Burner in this slack channel, and there are some more deep discussions going on, so feel free to join us.

Thanks again for starting this discussion, and I hope CodeIgniter4 will become even better!
Reply


Messages In This Thread
RE: Long-living PHP support (Swoole/RoadRunner etc) - by monkenWu - 10-15-2022, 07:20 AM



Theme © iAndrew 2016 - Forum software by © MyBB