n0nag0n / fatfree-swoole

A shim so you can use swoole and fatfree together
11 stars 2 forks source link

Still working solution? #4

Closed zafar-2020 closed 2 months ago

zafar-2020 commented 2 months ago

Hello @n0nag0n

I am setting up new server and wanted to explore setting up new server via Swoole HTTP server.

I have used the code, and made necessary changes to the code.

However, I am struggling to get it to work for my usecase.

I have latest stable Fatfree, and have swoole installed. Server seems to run ok, but I am having issues like header status code already passed, header is already passed etc.

Even URI etc is not working as expected. May be things with Swoole has changed sinced your changes.

Can this be looked into?

n0nag0n commented 2 months ago

I haven't touched this since I created this repo. I wouldn't want to be using this in production cause there's a high chance that there's a memory leak in the F3 code somewhere that will force you to restart swoole every so often as it will exhaust the memory on your machine. This was done more as a test to see "if" it could be done. It looks like it can, but it needs more work and I'm not in a place where I can put that work into this library.

What are you planning on using it for? Do you have an endpoint that receives an insane amount of requests that need to be handled quickly?

zafar-2020 commented 2 months ago

Based on my assumption that Swoole helps improve throughput, can run multiple process simultaneously, and keep in memory is what I am trying to leverage on. Basically, getting most from the existing server infrastructure rather than updating server.

Good thing is F3 is not as complex as other frameworks. I will try to play with it more and see if I get lucky.

Thanks for the reply and the proof-of-concept!

n0nag0n commented 2 months ago

For what it's worth, I spend my time on the Flight framework now and I'm trying to get Flight working with Swoole. I have it working, but there is a memory leak somewhere in the framework that I've been trying to hunt down. Since PHP isn't meant to hold state very well, it's hard to track down exactly where the leak is haha. https://github.com/flightphp/core/discussions/519. I have a private repo that I've been working with, but it still follows the same basic guidelines from this discussion.

zafar-2020 commented 2 months ago

The results as expected looks promising!

Keep going with that. Also noticed FlightPHP seems to be maintained, I will see how I go on my side. Will keep an eye on FlightPhp as well.

Cheers