monkenWu / CodeIgniter4-Burner

CodeIgniter4 out-of-the-box high-performance server.
https://ciburner.com/
MIT License
39 stars 4 forks source link

Questions and Support for Open Swoole #7

Closed AmitSonkhiya closed 1 year ago

AmitSonkhiya commented 2 years ago

Hi, I landed here from this Github issue and have a few questions.

  1. Would you please extend it for Open Swoole and Swoole (both are similar but differences exist)? I'm seeking one for Open Swoole.
  2. Could it support Redis memory caching as well like database connections?
  3. How about having a database/Redis connection inside coroutine (Open Swoole) specific?
  4. I believe the library supports WebSocket offered by the server (not by PHP) as well.

Thank you

AmitSonkhiya commented 2 years ago

Hi, since that page is designed to report bugs, I don't want to exploit that with side discussion 🙂. Hence writing herein.

I appreciate your efforts @monkenWu .

CI is indeed a better performer among frameworks with similar technology. However, after exercising with these request/response objects, I also feel the same with your view regarding long-living apps and CI.

Your library has shown me a path to combine Open Swoole and CI, or I may decide to switch to Workerman, yet I'm not sure about the success due to further issues that may arise. Additionally I'm tied up with the project deadline.

However, I would like to ask what other issues you may sense for future if sessions are not used. More clearly I'm seeking possibilities between stick with CI or seek alternatives.


And this rest is just my personal opinion. I don't know what is the plan for CI 5 or 6 but if there is one, I would like CI to work in a server independent manner. As of now you can see that CI is strictly bound to Apache behavior at many places which is causing the trouble.

Hence, to make CI more versatile and acceptable, it could be broken into 3 parts: App - App specific settings Mergers - Merger libraries for servers, like Apache, React PHP, Swoole etc. (it is the developer's job to set up the server), that would merge the request into CI core request (without calling so many APIs like setPath, setProtocol). System - CI core classes and the request array would be already prepared for it.

And yeah I like the way these non-traditional servers give request/response arrays that are easier to work than $_SERVER or various CI APIs. Hope CodeIgniter could add an easy array merge for these two types of Request/Response (server and CI) objects.

monkenWu commented 2 years ago

Hi, @AmitSonkhiya .

Hi, I spent some time doing a quick support and running basic test cases to ensure the http is working.

You can try the v0.2.1 version of burner, which now supports running with the OpenSwoole Driver. But it's currently in beta, so I'm not sure what problems it will encounter in the production.

I recommend that you refer to docker-compose.yml in the repository to build your environment, which that docker environment I use for development.

I'm very interested in the Open Swoole support, but now is early morning in my time zone and I have to go to bed so I can discuss it with you in more depth tomorrow.

I hope my project can help you.

AmitSonkhiya commented 2 years ago

Hi, my timezone is 5:30 hours ahead of UTC so I'm also not much far from sleeping time. 😄

I'm testing with it. Just I would suggest you to use WebSocket Server instead of the HTTP server since the former extends the later so that it could cover both HTTP/WSS requests and my project is also using that with custom Handshake 😄.

The Open Swoole version used in the docker is bit older. Here is the recent one: https://github.com/openswoole/docker-openswoole

In the meantime, here is a little assistance. Please use this library to utilize hot-reload with Open Swoole: https://github.com/phprtc/watcher

Also, there is a glitch that it has issue regarding shutting down the server while watcher is in the place. That issue could be read here and the developer confirmed that the concern is with Open Swoole itself and they are informed. So as of now, shutting down the server via the Server Control Panel is the only option.

Additionally, there is a ready script (not production ready) that could give an idea about firing Server stop/reload via PHP (if the watcher isn't used).

At last I would like to take our discussion to somewhere private (like Skype, Slack, Whatspp, Telegram, Discord etc.) if you're happy with that.

Thanks again for the prompt efforts.

monkenWu commented 2 years ago

Hi @AmitSonkhiya .

I have tried to create a slack workspace, you can discuss it here.