Roadrunner blew my mind

As someone who has been working with Laravel and it's Workers for a while now (8 whole Years), It never once crossed my mind why a Job running the same Logic as an API call executes so much faster.

But it's so damn obvious, every time I try to improve our response-times I bite myself in the ass for loosing around 50% of the total time the Request takes to the framework booting up ( yes we run artisan optimize, artisan route:cache, etc. )

Queue in me discovering Octane and finally reading up on it ( don't ask me why I haven't done that earlier, it pains me knowing it was out there waiting ).

Took me like half an hour getting Octane + Roadrunner setup in our local docker-compose stack. And voilĂ  no a single Request above 100ms left. That's insane.

I did have to refactor some things, it's a multi-tenant application, and we usually just bind the Tenant to the application as a Singleton in a middleware. There also was some Request in constructor Injection, which to my understanding is only bad if it's a Singleton (bind) which might get resolved during the boot process…

All in all

It's not in production yet since we need to test ist, adjust our CI/CD pipelines etc. BUT damn that was a low-hanging fruit.

Now I am questioning the use of fpm.

  • I can still use my nginx in front of Roadrunner
  • With most applications running in containers anyway, there is no benefit to fpm picking up source file changes.
  • Statelessness might be the only reason, but I think that's something one could easily flip.

Talking about statelessness

It just occurred to me that Laravel's array cache Driver now has actual real world use, not just for debugging or testing. You shouldn't store all the things in there. But storing a domain -> tenant map in memory rather than redis seems like another low-hanging fruit.

Down to 9ms on certain routes. FUCK YEAH It feels like navigating static html pages.