Giter Site home page Giter Site logo

Comments (6)

filips123 avatar filips123 commented on July 30, 2024 1

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.

from php-zmq.

ClosetGeek-Git avatar ClosetGeek-Git commented on July 30, 2024

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.

from php-zmq.

ClosetGeek-Git avatar ClosetGeek-Git commented on July 30, 2024

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.

from php-zmq.

ClosetGeek-Git avatar ClosetGeek-Git commented on July 30, 2024

I think it's a good idea though as long as users understand the limitations

from php-zmq.

zebastian avatar zebastian commented on July 30, 2024

One way or the other: a possible pure php polyfill for php-zmq should be maintained in its own project.
Please reopen, if still relevant.

from php-zmq.

ClosetGeek-Git avatar ClosetGeek-Git commented on July 30, 2024

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.

from php-zmq.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.