docs: Add warning on stateful services and shared memory model
This Pull Request proposes an update to the documentation to better explain FrankenPHP's Worker Mode.
The goal is to provide clear information regarding:
Associated Risks of state persistence (stateful services) across consecutive requests.
Best practices and tools (such as Symfony's ResetInterface or phanalist) to ensure a successful migration of applications to this high-performance model.
This clarification aims to prevent unexpected behaviors and facilitate the adoption of Worker Mode.
Thank you for the contribution, please add the English page as well, as that's the authoritative version.
I'm also not quite happy with the statement that workers introduce a shared-memory model. They don't really do that, they just don't reset the state between requests. They still don't share memory with other parallel requests.
I'm not a fond of the external link. They make the info harder to find. Couldn't we replace them with some examples?
We should also hint about the Symfony ResetInterface and explain that it's possible to mitigate these issues by configuring a maximum number of requests to handle (that can even be 1).
Hello 😄 I understand the comment. I have my doubts too, but I thought it would be better to cite my source than just copy and paste. I'll take a look at that. I have already tried setting the maximum number of requests to 1, but then the benefit of worker mode is minimal or even non-existent in terms of performance, or am I wrong?
Another question: is there a risk with libraries installed in a project? Even if I implement security measures in my code to ensure that I am managing statelessness correctly, how can I be sure that the problem cannot come from elsewhere?
Hello 😄 , do you have any other feedback? @dunglas @alexandre-daubois @94noni