You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
Is there a way php-uv can share tcp server port in multiple processes? Like what node.js's cluster module did?
"A single instance of Node runs in a single thread. To take advantage of multi-core systems the user will sometimes want to launch a cluster of Node processes to handle the load.
The cluster module allows you to easily create child processes that all share server ports."
Best Regards,
Jim
The text was updated successfully, but these errors were encountered:
The most straight-forward way to do this is via the SO_REUSEPORT socket option. It's available in linux kernel versions >= 3.9. When assigned this allows multiple processes/threads to bind to the same address/port tuple without issue. It should be possible to add support for this where available.
Another option I've used (though not with php-uv) is to fork a process with the sockets already bound. The child forks can then accept clients on the same socket independently of one another though the distribution of clients may not be even across the children.
I haven't tried to build php-uv on windows but in Win you can bind multiple sockets on the same port by default and don't need any additional socket options so this behavior would already be available there.
With libuv this is something that's a lot easier to accomplish at the C layer right now :/
Hi,
Is there a way php-uv can share tcp server port in multiple processes? Like what node.js's cluster module did?
"A single instance of Node runs in a single thread. To take advantage of multi-core systems the user will sometimes want to launch a cluster of Node processes to handle the load.
The cluster module allows you to easily create child processes that all share server ports."
Best Regards,
Jim
The text was updated successfully, but these errors were encountered: