Discuss Migrate to Pure PHP - Retiring node-pty and Node WebSockets #3469
Replies: 1 comment
-
A few throughts from my side...
To me it seems that the only viable solution would be to create something like a separate terminal server, that can host multiple PTYs in its process(es)*. This component could expose an API to create/read/write/resize/destroy terminals. As a goodie on top it also could provide a control plane for dedicated admin access (kinda a must have for bigger/clustered setups). [*] Internally mainly 3 resource structuring models would work:
Imho 1. is the best candidate for the PTY task for several reasons (Pros):
Ofc 1. also has a big Con - the theoretical max throughput is bound to the single process and all IO gets serialized through the event dispatcher in that single process. No fancy kernel scheduler can be used, scheduling/priority would have to be done "manually" at that event dispatcher. This may lower the saturation throughput with many PTYs pumping tons of data, if lousy implemented (a threaded model simply moves that responsibility into kernel realms). But again, terminals are often idle and still IO bound, so this is more of an unlikely edge case. Also a PTY itself is a quite heavy resource for the OS (by default limited to 4096 on linux). So it is not very likely either, that someone would want to serve 10k+ PTY via one process. And last but not least - if the single process approach really narrows throughput too much, one could simply spawn another terminal server process serving the next batch of PTYs. |
Beta Was this translation helpful? Give feedback.
-
Objective: Remove Node.js as a dependency by retiring
node-pty
and Node WebSockets, transitioning to a pure PHP solution for Coolify.While the impact on Coolify's performance is uncertain, this could be a valuable contribution to the PHP community. It may also lead to the development of a reusable library solving similar stuff.
Topics of interest:
Im starting this topic searching for technical insights, analysis, and suggestions from the community. At first it looked a crazy idea, but I could not solve this with current Libraries out there, so, maybe its a good idea. 😄
Beta Was this translation helpful? Give feedback.
All reactions