4 ms·
Can anyone dumb this down for me? I don't really understand this use case - is this for PHP developers to eke out some more performance for their web apps? Th
by rajangdavis 8y ago
Can anyone dumb this down for me?
I don't really understand this use case - is this for PHP developers to eke out some more performance for their web apps?
The goridge library (https://github.com/spiral/goridge https://github.com/spiral/goridge) makes a little more sense to me; it's a bridge between golang and PHP via RPC.
I went through the code (https://github.com/spiral/roadrunner https://github.com/spiral/roadrunner) but it doesn't seem like something you can swap into an existing PHP project. Can anyone explain what use case this might be for?
- kilburn 8y agoIn typical PHP applications, the entire application is bootstraped, executed and teared down for every request. RoadRunner lets you run "workers" (php processes) that perform all the bootstrapping just once, and then receive-process-reply to requests. The use case is to avoid the (possibly expensive, especially with modern frameworks) bootstrapping for every request. Check the symfony integration example for instance [1]. Everything that's outside of the while ($req = $psr7->acceptRequest()) { ... } is usually run for every request in traditional PHP, whereas here it is only run once when initializing the worker and then that while block reads/executes/replies to each specific request. The problem with this approach is that you now need to be careful not to leave unwanted stuff behind (open files / db connections, static $properties, etc.) that may interfere with future requests, whereas this just isn't possible in "normal" PHP. I would argue that this is one of the features that makes PHP so beginner-friendly. [1] https://github.com/spiral/roadrunner/wiki/Symfony-Framework https://github.com/spiral/roadrunner/wiki/Symfony-Framework
- rajangdavis 8y agoGot it. Thanks for the explanation!