This website uses cookies

Our website, platform and/or any sub domains use cookies to understand how you use our services, and to improve both your experience and our marketing relevance.

CloudwaysCDN — a powerful solution that offers superior performance and satisfied global audience for your business. Read More

Benchmarking CodeIgniter 3.x with PHP 5.6, 7.0 and 7.1: And The Winner Is?

Updated on  13th March

4 Min Read
Reading Time: 4 minutes

CodeIgniter performance benchmarks are essential reading for all developers who use the framework in their projects. Codeigniter is a popular framework for projects of all description and performance is the most important aspect of any web app

codeigniter benchmark with php 5.6 7.0 and 7.1

In this article , I will discuss Codeigniter 3.x  benchmarking with PHP 5.6, PHP 7 & PHP 7.1 by using Apache Benchmark & Codeigniter built-in library for benchmarking. I will use the login registration application to demonstrate Codeigniter PHP 5.6, PHP 7 and PHP 7.1 performance.

Prerequisites

For the purpose of this benchmarking run, I assume that you have downloaded and installed the CodeIgniter application on a server. My setup is:

First Case

  • Cloudways Managed Linode server : 2GB
  • Datacenter: Bangalore
  • PHP 5.6
  • No caching libraries
  • No of Users: 50, Requests 500-1000
  • Codeigniter 3.x

Second Case

  • Cloudways Managed Linode server : 2GB
  • Datacenter: Bangalore
  • PHP 7.0
  • No caching libraries
  • No of Users: 50, Requests 500-1000
  • Codeigniter 3.x  with PHP 7.0

Third Case

  • Cloudways Managed Linode server : 2GB
  • Datacenter: Bangalore
  • PHP 7.1
  • No caching libraries
  • No of Users: 50, Requests 500-1000
  • Codeigniter 3.x  with PHP 7.1

To start the test, I signed up to Cloudways and launched a PHP stack app hosted on a Linode server located at the Bangalore data center. I left all the settings to default. To ensure more clarity of the statistics on my hosting for PHP, I did not turn on any caching libraries such as Varnish or Redis on the server

Here is a list of services that are active on the server

Codeigniter 3.x & PHP 5.6 Benchmarks : 500 Requests & 50 Concurrent Users

Let’s open the SSH Terminal and go into the public_html/folder and write following command .

 

Codeigniter 3.x & PHP 7.0 Benchmarks: 500 Requests & 50 Concurrent Users

This test was conducted using Apache Benchmark.

Let’s open the SSH Terminal and go into the public_html and write following command .

 

PHP Version Setting

One of the main reasons why I opted for Cloudways is that it is easy to change the PHP version. All it takes is just a click. Just got to Settings & Packages (located under Server Management) and select the appropriate version.

Codeigniter 3.x & PHP 7.1 Benchmarks: 500 Requests & 50 Concurrent Users

Now, enter the following command in the SSH window:

 

Codeigniter Benchmarking Library

CodeIgniter offers a special “Benchmarking” class that is often used for benchmarking CI’s performance. This class measures the time used to run a code block for similar actions.

All you have to do is to mark a start point and end point and execute the elapsed_time() function between these two marked points. This way, you get the lapsed time for code execution.

This class is loaded automatically and can be used controller, view, and model classes.

Using the CodeIgniter Profiler Class

The CodeIgniter Profiler class outputs all benchmark results and queries you have run, and $_POST data at the bottom of your pages.

To disable the profiler, simply place the following code anywhere in your Controller

Related: How To Upgrade From PHP 5.X To PHP 7

The Winner

The test generated the following statistics

Sno Parameters CI 3.x + PHP 7.1 CI 3.x + PHP 7.0 CI 3.x + PHP 5.6
1 Region Bangalore Bangalore Bangalore
2 Concurrency Level 50 50 50
3 Time Take For Test 0.909 seconds 0.889 seconds 0.916 seconds
4 Complete Requests 500 500 500
6 Total Transferred [bytes] 279000 bytes 279000 bytes 279000 bytes
7 Keep ALive Requests 500 500 500
8 Request Per Second 550.09 562.05 546.12
9 Time Per Request 90.895 mean 88.858 mean 91.554
10 Time/Request [mean ms](mean across concurrent users) 1.818 ms 1.777  ms 1.831
11 Failed Request 0 0 0
12 Transfer Rate 299.75 Kbytes/sec 306.63 Kbytes/sec 297.59

By observing the above table, I can conclude the following points:

  • PHP 7.0 Request per second 562.05
  • PHP 7.1 Request per second 550.09
  • PHP 5.6 Request per second 546.12

Wrapping it Up

From this CodeIgniter benchmark results, it is clear that it performed very similar on PHP 7.1 and 5.6. This shows that the developers do not have to worry about the performance of their CodeIgniter apps on either of the two PHP versions.However , CodeIgniter 3.17 has handle slightly more request with 7.0 as compared to PHP 7.1 & 5.6.

 

Please Retweet if you liked this article, and don’t hesitate to follow me on Twitter, and/or here on Cloudways. 😉 Thanks for reading.

Share your opinion in the comment section. COMMENT NOW

Pardeep Kumar

Pardeep is a PHP Community Manager at Cloudways - A Managed PHP Hosting Platform. He love to work on Open source platform , Frameworks and working on new ideas. You can email him at pardeep.kumar@cloudways.com

Start Growing with Cloudways Today.

Our Clients Love us because we never compromise on these

THERE’S MORE TO READ.