I’ve been using Zend Framework 1.x for quite a long time. It is a stable framework with a lot of features. But I always have some performance issues in terms of memory/cpu usage and page load time. I have looked at the new version of Zend Framework which is under active development. As my first impressions, I have astonished by their new design. Removing require_once statements, using namespaces and lazy loading of components should boost the performance drastically. In addition, the new module system will be very flexible especially for 3rd party component developers.
To see it in action, I have decided to do a quick benchmark. I have used the zf2 skeleton application, and my current zend framework 1.11 setting which I use in any of my PHP projects. The comparison is totally subjective and the aim is to have an overall impression.
I have used the apache benchmarking tool. The number of requests are 100 and the concurrency level is 5.
ab -c 5 -n 100 http://myUrl
Here are the results
Zend Framework 2
Server Software: Apache/2.2.20
Server Hostname: localhost
Server Port: 80
Document Path: /zf2-sample/public
Document Length: 351 bytes
Concurrency Level: 5
Time taken for tests: 0.214 seconds
Complete requests: 100
Failed requests: 0
Write errors: 0
Non-2xx responses: 100
Total transferred: 61900 bytes
HTML transferred: 35100 bytes
Requests per second: 466.58 [#/sec] (mean)
Time per request: 10.716 [ms] (mean)
Time per request: 2.143 [ms] (mean, across all concurrent requests)
Transfer rate: 282.04 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 10 6.3 11 33
Processing: 0 1 2.6 0 15
Waiting: 0 0 2.6 0 15
Total: 1 11 6.1 11 33
Percentage of the requests served within a certain time (ms)
50% 11
66% 12
75% 13
80% 14
90% 16
95% 23
98% 32
99% 33
100% 33 (longest request)
Zend Framework 1.11
Server Software: Apache/2.2.20
Server Hostname: localhost
Server Port: 80
Document Path: /ad
Document Length: 336 bytes
Concurrency Level: 5
Time taken for tests: 0.410 seconds
Complete requests: 100
Failed requests: 0
Write errors: 0
Non-2xx responses: 100
Total transferred: 58900 bytes
HTML transferred: 33600 bytes
Requests per second: 243.98 [#/sec] (mean)
Time per request: 20.494 [ms] (mean)
Time per request: 4.099 [ms] (mean, across all concurrent requests)
Transfer rate: 140.33 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 20 14.7 16 53
Processing: 0 1 3.6 0 28
Waiting: 0 1 3.5 0 28
Total: 1 20 14.4 17 53
Percentage of the requests served within a certain time (ms)
50% 17
66% 29
75% 33
80% 34
90% 40
95% 46
98% 51
99% 53
100% 53 (longest request)
Conclusion: New version of Zend Framework is nearly double times faster that the current version.