Accelerating PHP Application

Accelerating PHP Application


During past couple of years we were using platforms/websites that were failing under heavy load. That got us thinking. How to create something that people can take ideas from and build upon which can handle reasonable load in reasonable expenses. For that we created a goal to handle 30,000 requests per minute in the most cost-effective way.

To handle this situation we were thinking to develop such an application with GoLang, which itself is a very efficient platform in itself. But later decided to engage with more audiences picked a challenge ourselves and set up our goal to build the application with PHP.


We set the target to serve 30,000 requests per minute (500 requests per/sec).

Framework Selection

We choose lumen for its simplicity.

Database Selection

Most PHP applications work with MySQL database. However, we don’t need MySQL for all the cases. We chose NoSQL for this application and decided to use MongoDB.


Lumen is fast but not enough to serve 30K requests per minute for our application, which was supposed to be run with minimum resources. So, we added some sauce over Lumen named Swoole.

What is SWOOLE?

Compared with other async programming frameworks or software such as Nginx, Tornado, and Node.js, Open Swoole is a complete async solution that has built-in support for async programming via fibers/coroutines, a range of multi-threaded I/O modules (HTTP Server, WebSockets, TaskWorkers, Process Pools) and support for popular PHP clients like PDO for MySQL, Redis, and CURL. You can use sync or async, coroutine, fiber API to write the applications or create thousands of lightweight fibers within one Linux process. Swoole enhances the efficiency of your PHP applications and brings you out of the traditional stateless model, enabling you to focus on the development of innovative products at a high scale, brining event loops and asynchronous programming to the PHP language.

You will find more about Swoole on their official website.


Here is some performance benchmark for our demo application:

Machine description:

Initial load tests were done in the following configuration:

1. 2x t3.medium (2CPU/4GB Mem) instances to host API.
2. 1x t3.small (2CPU/2GB Mem)Redis cluster with 1 node.
3. MongoDB hosted in 1x t3.medium (2CPU/4GB Mem) instance.
4. Tsung hosted in GCP in 4 pods.

Load Test


Falcon with Swoole combination could be an alternative solution. We choose Lumen for its simplicity over Falcon.

Laravel Octane is also can be a good choice.

You will find this project on Github:


Yml or Yaml for DevOps

As software engineers, we are always learning new tech stacks as we process our careers. Everyone who works on any short of software farm all came across a term called DevOps. As the name suggests, ...

Working with DocuSign, Authorization and Sending Document for Signature

DocuSign is a well known platform where users can send their document for signing via email or your app. I will try to show you how DocuSign authorize an user and how can we send a document to users ...

Worker Pool in Golang

Tags: #advance #topic #golang #goroutine #channels #workerpool #threadpool Often we end up with some work which is so time-consuming that if we’re able to assign, multiple person/worker, to do ...
java web application

Top 9 Practical Benefits Of Using Java Web Application

Java web application frameworks have one of the greatest and largest communities of software engineers in the world. Companies can build a team with the help of this community at ease. There are different communities to help beginners, intermediate as well as expert developers.

Read More