CodeIgniter 4 Bench Tests
in category Diagnostics -> PHP Applications -> CodeIgniter 4 Bench Tests. Updated at Wed, 21 Feb 2024 18:32:32 EST
Checking the performance of CodeIgniter 4 with Apache Bench.
My bench tests for CodeIgniter 4. This is a fresh install of CodeIgniter, there is not even a database defined yet. I added a route controller for /home only. Codeigniter looks impressive, but keep in mind nothing actually exists in this build yet.
$ ab -c1 -n50 https://ci4.localnet/home/
This is ApacheBench, Version 2.3 <$Revision: 1903618 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking ci4.localnet (be patient).....done
Server Software: Apache
Server Hostname: ci4.localnet
Server Port: 443
SSL/TLS Protocol: TLSv1.3,TLS_AES_256_GCM_SHA384,2048,256
Server Temp Key: X25519 253 bits
TLS Server Name: ci4.localnet
Document Path: /home/
Document Length: 233 bytes
Concurrency Level: 1
Time taken for tests: 0.742 seconds
Complete requests: 50
Failed requests: 32
(Connect: 0, Receive: 0, Length: 32, Exceptions: 0)
Non-2xx responses: 50
Total transferred: 19572 bytes
HTML transferred: 10562 bytes
Requests per second: 67.42 [#/sec] (mean)
Time per request: 14.833 [ms] (mean)
Time per request: 14.833 [ms] (mean, across all concurrent requests)
Transfer rate: 25.77 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 10 12 1.7 12 21
Processing: 2 2 0.4 2 3
Waiting: 1 2 0.4 2 3
Total: 12 15 1.8 14 24
Percentage of the requests served within a certain time (ms)
50% 14
66% 15
75% 15
80% 16
90% 17
95% 17
98% 24
99% 24
100% 24 (longest request)
If I hit the front page, I get this:
$ ab -c1 -n50 https://ci4.localnet/
This is ApacheBench, Version 2.3 <$Revision: 1903618 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking ci4.localnet (be patient).....done
Server Software: Apache
Server Hostname: ci4.localnet
Server Port: 443
SSL/TLS Protocol: TLSv1.3,TLS_AES_256_GCM_SHA384,2048,256
Server Temp Key: X25519 253 bits
TLS Server Name: ci4.localnet
Document Path: /
Document Length: 40015 bytes
Concurrency Level: 1
Time taken for tests: 7.256 seconds
Complete requests: 50
Failed requests: 13
(Connect: 0, Receive: 0, Length: 13, Exceptions: 0)
Total transferred: 2013837 bytes
HTML transferred: 2000737 bytes
Requests per second: 6.89 [#/sec] (mean)
Time per request: 145.130 [ms] (mean)
Time per request: 145.130 [ms] (mean, across all concurrent requests)
Transfer rate: 271.02 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 9 11 1.1 11 15
Processing: 131 134 2.3 134 141
Waiting: 130 132 2.3 132 140
Total: 141 145 2.7 144 154
Percentage of the requests served within a certain time (ms)
50% 144
66% 145
75% 146
80% 146
90% 149
95% 150
98% 154
99% 154
100% 154 (longest request)
There is some default content on the default front page and that is quite a response speed difference from the static page at /home. CodeIgniter can be investigated some more because that first test is really, really impressive. I would build into this framework and feel somewhat confident that my PHP app is built well. I have not scanned this build for any security issues yet.
I may add a database to this build and re-test in the near future. I can use that base for any future CodeIgniter projects that land on my desk.
Keywords
codeigniter framework, php frameworks, codeigniter 4 performance