What is the complexity and effort of making an application worker mode compatible? (Example: Nextcloud) #1675
-
|
A little background about me. I've been called a digital fireman or problem solver, dealing mostly with obscure issues that others don't want to solve. Mostly playing in the web hosting and development space, with some networking and Wi-Fi tech on the side. My skills are advanced (+ motivation), but not high-level expert, and mostly around hosting, not actual development. So I don't write code from scratch but modify it to fix a bug from time to time. With the intro out of the way, my question is as follows: What is the complexity and effort of making an application worker mode compatible?Meaning, are the examples of how to create a In nextcloud/server#16726 (comment) (direct link to my FrankenPHP comment), there was a discussion about switching to go for parts of the applications, which has been done for a notification service with Rust. While there is no plan to switch away from PHP fully, more modularity is being adapted to allow "apps" to be written in other languages. Currently, I cannot gauge how much work it would be to adapt the code base for the worker mode. Based on the answers, I am considering trying my own hand at it, finding some volunteers, or paying somebody to invest the time, so there is no dependency on the Nextcloud maintainers time and prioritization. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
|
The example in the docs is actually how you would wrap an application (here is the Symfony runtime as an example. How complex it is to make an existing application worker-compatible always depends on the application itself though. The more global and static variables an application relies on, the harder it is to make it worker mode compatible. If you look at Symfony Runtime as an example, it ends up being a relatively small wrapper around the framework, since the runtime already decouples Symfony from any global state and Symfony generally relies on a lot of DI. Other worker implementations like the one for Laravel go through a lot of effort to reset global state, since Laravel relies on a lot of singletons, facades etc. I would say to make an application worker mode compatible (especially an old one) you probably need to have quite a bit understanding of how that application handles state. Especially how it handles global state. An application that relies on a lot of 'good practice' (like DI) would probably be easier to integrate with a peristent model (like worker mode) or an async model. I'm not familiar with the Nexcloud codebase, so it's hard to say how much work it would be (does it only have 1 entrypoint?). |
Beta Was this translation helpful? Give feedback.
The example in the docs is actually how you would wrap an application (here is the Symfony runtime as an example.
How complex it is to make an existing application worker-compatible always depends on the application itself though. The more global and static variables an application relies on, the harder it is to make it worker mode compatible.
If you look at Symfony Runtime as an example, it ends up being a relatively small wrapper around the framework, since the runtime already decouples Symfony from any global state and Symfony generally relies on a lot of DI. Other worker implementations like the one for Laravel go through a lot of effort to reset global state, since Laravel relies on …