Redis Large Scale Laravel 5.2 – Problems, Tip and Tricks – Part 2

Table of Content

In the previou post Large Scale Laravel 5.2 – Problems, Tip and Tricks , i introduced how to build an example web application using Laravel 5.2 and how we create the “Production Environment” in our local computer with Docker.

Its also refering to what people are using to design a “Scaleable Application” in real life now, with Redis, Mysql Replication and HAProxy Load Balancer.

In this post, i will step by step using HP Load Runner to load a huge amount of request to our current system, to see if this system can handle alot of Concurrent Users or not.

Our current project code and Docker files.

In previous post, we have some important files as below :


Our .env

Our Dockerfile

Run our system in Docker : docker-compose up -d --force-recreate

Create database and run php artisan migrate && php artisan db:seed.

Our website now will run smoothly at http://localhost:8000.

Next we need to fix the login in our code to allow Testing Script submit Gift without login by change in GiftsController.php

Now the time we work with Load Testing using HP Load Runner 11.0.

Using Hp Load Runner for testing perfomance.

Install Hp Load Runner 11.0

Current latest version now is 12.53, but i have HP Load Runner 11.0 so i install this.

The free version of HP Load Runner is limited users, which is useless for testing perfomance, so i suggest you by the lisence from HP or finding crack information over internet.

Maybe get the free License Keys at

Im using Ubuntu so i need setup VirutalBox with Windows for install HP Load Runer 11.

It will result as below :


First we create the script for Load Runner by using “Rercoding Section”

Please note that because im running this script from VirtualBox machine so i must change URL from “http://localhost:8000” to “”.

OK now we run with about 1K user in HP Load Runner and see below for result screenshot :


Opps, our project die with so many errors.

So we go to find out what is problem with current systems.

Detect problem with current system.

First we take a look at Nginx log on our 2 web servers.

Run docker ps :

View the error logs on PHP5-FPM servers :

We will see :

It means that on PHP5-FPM configuration, setting for pm.max_children are too low.

Increase this on both servers, using command as below :

And change exactly as below :

Restart PHP5-FPM :

And we test with HP Load Runner again.

Oops! We still got many errors from HP Load Runner Results :

Check our Laravel Log, we got :

Seems that we need increase the max_connection setting for MySQL.

Check current max_connection setting :

I will increase it to 500 on both MySQL servers :

Now we test again and got errors :

Our databases dead! Lets add below to MySQL configuration :

And add below [mysqld] section

Save and restart MySQL.

Test again and we see website very slowly but still running.

We check slow-queries.log

Oops we using WHERE query but not index :

Go update migration :

Migration :

Ok now we clear the /var/lib/mysql/slow-queries.log and try test again.

Everything look very cool at result from HP Load Runner.

Thanks for reading!

Leave a Reply

Your email address will not be published. Required fields are marked *