-
Notifications
You must be signed in to change notification settings - Fork 119
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Possibility for pure PHP package #202
Comments
First, the performance impact would be huge in many (most?) situations. This isn't considering PHP's performance compared to native as much as the fact that standard libzmq handles io in optimised threads, where pure PHP would at best be a single thread with non-blocking sockets. This fact alone also means that it isn't possible to follow zmqs official specs. In the future extensions like pth or pthreads could be used to do this in PHP userspace but currently both extensions have significant performance issues with intra-thread communication. Outside of this fact, yes it is possible. Search "PHP zmtp" and you can find limited examples of pure PHP scripts handling at least pub/sub and push/pull using standard PHP streams. |
Is it possible to then just create "polyfill" and use it when the extension is not available? Even if it is slow, it's better than nothing. |
This should be entirely possible but I can see it creating problems when used. For example, if the underlying framework makes it impossible for a consumer to keep up with a producer it's sure to fail. |
I think it's a good idea though as long as users understand the limitations |
One way or the other: a possible pure php polyfill for php-zmq should be maintained in its own project. |
It's entirely possible to set up a standard system socket using PHP, and entirely possible to process incoming/outgoing packets per zmtp specifications using PHP - it's just not possible to process the packets fast enough to work once put under any type of real load. This isn't a PHP issue. The polyfill WOULD be able to effectively keep-up with C (Java, etc) based implementations if they were using the same single-threaded/generic socket design. |
Is it possible to make pure PHP package for ZeroMQ, without any C code or additional extensions?
If it won't negatively affect performance, it would be very good, because it would enable easier installation (with Composer) and usage.
The text was updated successfully, but these errors were encountered: