> Forgive my ignorance, but why no connection?  You mean the
> pre-worker-start part needs to avoid an SQL connection?  Why is that?  That
> would be something that needs to be super-well documented, and possibly
> some guards in place to prevent it, if there's no good way around it.
> (This is the sort of detail I'm thinking of, where I just don't know the
> implications but want to think through them as much as possible in advance,
> so that it can be "safe by design.")
>

Sorry, I made a typo. I mean "libraries must ensure that the connection
**is** active" (if the connection timeout has been reached, the library
must reconnect).
Your worker script will be long-running code, as in Java, Go, etc. So if it
depends on external services, it must check that the connection is still
active, and reconnect if necessary.
This is the default in most languages, but not in PHP (yet).

Do you have an intent or expectation of a worker-style SAPI being shipped
> with PHP itself, or for that to remain the domain of third parties?
>

As I tried to explain in my previous message, this could be nice, and
possible, but I don't plan to do it myself for now :)


> I mean more what implications would there be on how user-space code is
> written to be worker-SAPI-friendly.  (The SQL connection comment above, for
> example.)  I have not worked with any of the worker-ish tools so far
> myself, so other than "you'll need an alternate index.php for that", I
> don't have a good sense of what else I'd want to do differently to play
> nice with Franken and Friends.
>

As far as I know, there are no other implications than memory (and other
resources) leaks (https://laravel.com/docs/10.x/octane#managing-memory-leaks)
and timeout handling.


> The idea of combining fiber-based code with supported worker-mode runners
> sounds like a ridiculously cool future for PHP, but I don't know how windy
> that path is. :-)
>

That already works if you use FrankenPHP! Joe also experimented
successfully using the parallel extension instead of Fibers:
https://twitter.com/krakjoe/status/1587234661696245760

Reply via email to