PHP is sooo yesterday. It’s slow. It’s not hip. Don’t use it.
That’s what people say.
Well, people, listen up! Because RoadRunner has come to pimp PHP performance in astounding dimensions. So let’s take a look at what RoadRunner is.
RoadRunner – application server, load balancer, process manager
RoadRunner supports protocols and tools needed in today’s cloud-based development environment. HTTP2, gRPC, PSR-7, Queue, but also provides a health check API, metrics via Prometheus or you can run your PHP app as an AWS Lambda.
You can use it with a multitude of PHP Frameworks, such as Symfony or Laravel, their own Spiral-Framework, or your custom PHP code. Docker images for easy integration into your setup are available.
What is our use case?
In our project, we need to import heaps of documents. Nearly 100,000, summing up to around 15GB of data. We had a PHP endpoint behind an nginx to receive the data which worked well on a smaller scale, but it died after half an hour and not even 10k of documents.
Instead of debugging the reasons, a colleague of mine seized the opportunity to check out RoadRunner with the Spiral framework. In a day he wrote the code to trigger and work through the data import, dumping the data after having it zipped into a Postgres database. The zipping unfortunately takes its time, but one document is now processed in roughly 4ms. That’s milliseconds! The whole 15GB of data will take less than 10 minutes.
Seriously, check out the RoadRunner code and look in your network tab. Run your own benchmarks. PHP is slow? Not any more.