On the road with Roadrunner
By: Yorick Girard
Tags: Roadrunner, PHP, Symfony

ManoMano is a French Home Improvement company, launched in 2013. Since day one, the technology has been put at the heart of our strategy, as ManoMano developers, we are always looking for ways to improve our engineering standards, skills and processes.

In the ManoMano ecosystem there’s a lot of microservices. When we build some new micro-services we are taking into account the number of requests each micro service will handle, how we’re going to scale, how fast each micro service needs to answer.

How it all started for us?

While working on moving our PHP applications to containers, “Roadrunner”, a PHP application server load balancer, process manager developed by the company Spiral Scout held our attention.

The figures displayed on their website are extremely encouraging! Our current architecture at ManoMano, “PHP-FPM”, is supposed to be approximately 5 times slower than Roadrunner.:

Source: Roadrunner.dev

Let’s challenge those promises!

The configuration using a yaml file is straightforward, Roadrunner appears to integrate well with many PHP frameworks including the one used at ManoMano “Symfony”, so we tried it!

Roadrunner is written in GoLang and uses one of the benefits of Go, the multi-threading, Goroutines, to power up PHP. Your application runs in a worker and each worker runs in a “Goroutine”, a lightweight version of a thread. You can define the number of workers needed for your application in the configuration file. Roadrunner will then balance the incoming requests on the workers.

Since it keeps PHP alive, the kernel, the configuration files, are loaded only once, then on each request your business logic is loaded. Roadrunner solves the start time overhead caused by the framework, the configuration…

At ManoMano we were using (and still on some legacy) the architecture PHP FPM + NGINX, which involves two instances.

Roadrunner doesn’t need PHP FPM anymore so the architecture is lighter.

Stress test

Using siege, a command line tool to stress test tool, we ran 1000 requests on each stack locally which gave us the figures below:

Using a dockerized project with PHP FPM + NGINX, we were able to handle 46.9 transactions per second, which is okay since it’s locally. On the other hand, with the same project, using a dockerized project with Roadrunner, we were able to handle 1204.82 transactions per second.

It means that I would need 25 machines with PHP FPM + Nginx to handle the same amount of transactions as Roadrunner.

The tests we have done led us to this conclusion:

Pros:

As seen in the figures, using Roadrunner makes your application significantly faster, thus improving the scalability

Using only one machine instead of two is a money saver and simplifies your deployment process

Roadrunner allows you to use Go libraries

Clear documentation

Cons:

There are few instructions that will break your project running on Roadrunner, due to its architecture Roadrunner is not able to handle them, you can find the list on the documentation

The community of people using Roadrunner is still small compared to the one using PHP FPM + NGINX.

We would definitely recommend more people to run tests on it, try it and go further. The Roadrunner community needs to grow.