Laravel Nginx + PHP-FPM, Nginx Unit, RoadRunner Octane Benchmark
<https://zenn.dev/yamayuski/articles/96478cb4fe1573 <https://github.com/il m yamagishi/laravel loadtest <https://habr.com/en/post/646397/ You can find out more
https://zenn.dev/yamayuski/articles/96478cb4fe1573
https://github.com/il-m-yamagishi/laravel-loadtest
https://habr.com/en/post/646397/
You can find out more above.
This is a makeshift write-up of what I tried. While making various changes related to the Docker settings, I definitely felt that Nginx and PHP-FPM had gotten faster. So I couldn't stop halfway, and eventually ended up here.
I started at 2 p.m. and finished at 5 a.m., so I spent 15 hours doing this...
5,000 users, requests
But!!! The server's DNS is set to CloudFront, and I run the server machine myself (Threadripper 3990, 256 GB), and I sent the requests myself, too. (Since I'm sending requests to myself, I may be limited by the bandwidth of the network I'm using to send them, so the results may not be accurate.)
Anyway, I tried it.
If the Nginx workers can't keep up, Nginx will definitely crash.
But even if you increase the number of Nginx workers, PHP-FPM's latency keeps increasing.
There are also occasional failed requests.
People seemed to have mixed opinions about it, so I gave it a try.
Wow... what is this? Nginx Unit's performance is unbelievably fast. It delivered speeds comparable to a setup with Octane. This is crazy... If you configure it properly, it seemed like Nginx Unit alone would be more than enough.
However, because of my lack of configuration skills, Nginx Unit crashed completely and never came back.
(I think this was probably due to my lack of configuration skills; I don't think Nginx Unit would crash if configured properly. But why doesn't everyone use Nginx Unit? Hmm... PHP is also stuck at 8.1.1. It's 8.1.16 now. <Of course, I could build the Docker image myself using a Dockerfile, but that's a hassle.>)

I think I was pessimistic about Octane in my previous post, but this time is different. I definitely recommend it. The coding approach changes a little, but I think the advantages really outweigh the disadvantages.
First of all, it doesn't crash. However, latency increases. I think it went up to 1–3 seconds.

And the important thing is, it can't handle much RPS...
At first, I thought using RoadRunner alone would be much better, but I was wrong.
Of course, my configuration could be the problem.

This is the first result. Even with an RPS of 1846, it ran perfectly well and very fast.
I was surprised when I saw this, so I ran it one more time.

The result was the same.
The reason the RPS drops off later is probably that I've hit the limits of my network bandwidth for both input and output.
In any case, the Nginx + RoadRunner setup increased RPS faster than the RoadRunner-only setup, handled more requests, and showed faster response times in milliseconds while doing so.
I highly recommend using Laravel Octane. The server never crashes, even under a tremendous number of requests.
Connect RoadRunner through Nginx workers in front of it, rather than connecting to it directly. That can handle more requests and respond faster.
This test is subjective.
Also, since both the computer network sending the requests and the server computer were mine, the results may be inaccurate.
My computer -> CloudFront -> server computer
I had a very valuable experience over those 15 hours... But I have work I need to do.. :(