-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathzend-framework2-performance.html
162 lines (153 loc) · 11.1 KB
/
zend-framework2-performance.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Yet another Zend Framework 2 performance test</title>
<link rel="stylesheet" href="http://www.piotrdeszynski.com/theme/css/main.css" />
<link href="http://www.piotrdeszynski.com/feeds/all.atom.xml" type="application/atom+xml" rel="alternate" title="Yet another boring programmer's blog Atom Feed" />
<!--[if IE]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
</head>
<body id="index" class="home">
<a href="https://github.com/piteer1">
<img style="position: absolute; top: 0; right: 0; border: 0;" src="http://s3.amazonaws.com/github/ribbons/forkme_right_red_aa0000.png" alt="Fork me on GitHub" />
</a>
<header id="banner" class="body">
<h1><a href="http://www.piotrdeszynski.com/">Yet another boring programmer's blog </a></h1>
<nav><ul>
<li><a href="http://www.piotrdeszynski.com/category/oop.html">OOP</a></li>
<li class="active"><a href="http://www.piotrdeszynski.com/category/misc.html">Misc</a></li>
<li><a href="http://www.piotrdeszynski.com/category/javascript.html">JavaScript</a></li>
<li><a href="http://www.piotrdeszynski.com/category/about.html">About</a></li>
</ul></nav>
</header><!-- /#banner -->
<section id="content" class="body">
<article>
<header>
<h1 class="entry-title">
<a href="http://www.piotrdeszynski.com/zend-framework2-performance.html" rel="bookmark"
title="Permalink to Yet another Zend Framework 2 performance test">Yet another Zend Framework 2 performance test</a></h1>
</header>
<div class="entry-content">
<footer class="post-info">
<abbr class="published" title="2012-10-22T20:00:00">
pon 22 października 2012
</abbr>
<address class="vcard author">
By <a class="url fn" href="http://www.piotrdeszynski.com/author/piotr-deszynski.html">Piotr Deszyński</a>
</address>
<p>In <a href="http://www.piotrdeszynski.com/category/misc.html">Misc</a>. </p>
<p>tags: <a href="http://www.piotrdeszynski.com/tag/php.html">PHP</a><a href="http://www.piotrdeszynski.com/tag/frameworks.html">Frameworks</a><a href="http://www.piotrdeszynski.com/tag/zend-framework-2.html">Zend Framework 2</a><a href="http://www.piotrdeszynski.com/tag/symfony-2.html">Symfony 2</a><a href="http://www.piotrdeszynski.com/tag/performance.html">Performance</a></p>
</footer><!-- /.post-info --> <p>We have full version of ZF2! There's even a Zend Framework 2.0.3 version. Full of optimism I've started reading about it and
full of curiousity I've looked on performance charts. How big was my surprise when i've looked on charts seeing that ZF2 is 4 times slower
than ZF1 <a href="http://www.enrise.com/2012/02/zend-framework-2-performance/">Enrise</a>. Said to myself, it's an old post and tests were done on an old
version of ZF2, so probably it's not so bad at the end. Still I didn't think about doing that day any tests by myself.</p>
<p>Few days ago I saw another great post by <a href="http://www.enrise.com/2012/02/zend-framework-2-performance/">trq</a>. He in opposition to previous test compared ZF2 with other
decent frameworks (<strong>Symfony 2</strong> and <a href="http://proemframework.org">Proem</a>). Sadly this time also it didn't satisfy me with the results. For my luck test framework written by <em>trq</em> is
available at <a href="https://github.com/trq/phpBenches">Github</a>. In the meantime I've found an module for ZF2 which caches classes (and as they write <em>"EDPSUPERLUMINAL - Caches the common Zend* classes used by your application into a single cache file, reducing reliance on the autoloader, and greatly improving the baseline performance of ZF2. By EVAN COURY"</em>) on official ZF2 modules page. Being unsure if in testes done by <em>trq</em> class caching was turned on, full of optimism I've decided to make tests by myself.</p>
<h2>Machine spec</h2>
<p>I've run tests on machine</p>
<ul>
<li>Core i7 Intel® Core™ i7-2630QM Processor (6M Cache, up to 2.90 GHz)</li>
<li>16 GB DDR-3 RAM</li>
<li>1TB (RAID 2x500GB 7200 RPM STRIPE) HDD</li>
<li>Kubuntu 12.04</li>
</ul>
<h2>Environment</h2>
<ul>
<li>PHP 5.3.10-1ubuntu3.4 with Suhosin-Patch (cli) (built: Sep 12 2012 18:59:41)</li>
<li>Apache/2.2.22 (Ubuntu)</li>
<li>APC</li>
<li>xhprof</li>
</ul>
<h2>First try - without a class cache</h2>
<p>Basically my results didn't differ from one provided by <em>trq</em>
<img alt="Requests per second" src="/images/2012/10/no_cache_zf2/request-per-second.png" title="Requests per sec" />
<img alt="Response time" src="/images/2012/10/no_cache_zf2/response-time.png" title="Requests per sec" />
<img alt="Number of function calls" src="/images/2012/10/no_cache_zf2/number-of-function-calls.png" title="Number of function calls" />
<img alt="Number of files included" src="/images/2012/10/no_cache_zf2/number-of-files.png" title="Number of files included" />
<img alt="Average load" src="/images/2012/10/no_cache_zf2/loadavg.png" title="Average load" />
<img alt="Memory usage" src="/images/2012/10/no_cache_zf2/memory-usage.png" title="Memory usage" /></p>
<p>As you can see <strong>ZF2 is far behind Symfony 2</strong>. Response time was 4 times slower. That's quite bad. Let's move on to second try.</p>
<h2>Second try - with a class cache</h2>
<p>Before making second try, I've added into <em>ZF2 Skeleton App</em> <strong>EdsSuperLuminal</strong> module and enabled it (this module is available at <a href="https://github.com/EvanDotPro/EdpSuperluminal">Github</a>)
<img alt="Requests per second" src="/images/2012/10/with_cache_zf2/request-per-second.png" title="Requests per sec" />
<img alt="Response time" src="/images/2012/10/with_cache_zf2/response-time.png" title="Requests per sec" />
<img alt="Number of function calls" src="/images/2012/10/with_cache_zf2/number-of-function-calls.png" title="Number of function calls" />
<img alt="Number of files included" src="/images/2012/10/with_cache_zf2/number-of-files.png" title="Number of files included" />
<img alt="Average load" src="/images/2012/10/with_cache_zf2/loadavg.png" title="Average load" />
<img alt="Memory usage" src="/images/2012/10/with_cache_zf2/memory-usage.png" title="Memory usage" /></p>
<p>What a surprise... results didn't change too much!
To be honest I got dissapointed. I was hoping for competition between ZF2 and Symfony 2 (or at least 50% performance boost) but looking at these graphs we
can observe around 20% increase in number of requests handled. Still something, but comparing to <em>Symfony 2</em> It's quite a low value. Looking at the results further
we could say that <em>ZF2</em> will be using quite less I/O operations (from 163 to 20 included files, it's quite a result), but still memory usage might be a little terryfying.</p>
<h2>Should I care?</h2>
<p>Depends. In most of cases these results doesn't matter. Firstly this is "Hello World!" test. Such tests doesn't have too big meaning in real life applications,
where bottleneck is mostly a database. Secondary, in most of the cases you don't need to squeeze 60 ms from your servers. In case of websites with huge traffic, sadly
<em>ZF2</em> is not the best choice. In such a website 60ms difference might be huge performance impact. <em>Math.pow('Sadly', 2)</em> because I'm looking for framework
for a one of my company's big pages, cause it needs a lot of updates and rather I won't be able to use this framework. There performance really matters.</p>
<h2>What next?</h2>
<p>I have to wait. Hope that there will be some performance tunning with next minor releases of <em>ZF2</em>. Until then I might stick to <em>Symfony 2</em> or to some smaller framework available.
If you want want to try it by yourself you can clone <em>trq</em> (requires PHP 5.4) repository, or mine forked repository with code updated to support PHP 5.3 available at <a href="https://github.com/piteer1/phpBenches">Github</a></p>
</div><!-- /.entry-content -->
<div class="comments">
<h2>Comments !</h2>
<div id="disqus_thread"></div>
<script type="text/javascript">
var disqus_identifier = "zend-framework2-performance.html";
var disqus_url = "http://www.piotrdeszynski.com/zend-framework2-performance.html";
(function() {
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
dsq.src = 'http://yetanotherboringprogrammersblog.disqus.com/embed.js';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
})();
</script>
</div>
</article>
</section>
<section id="extras" class="body">
<div class="blogroll">
<h2>blogroll</h2>
<ul>
<li><a href="http://docs.notmyidea.org/alexis/pelican/">Pelican</a></li>
<li><a href="http://python.org">Python.org</a></li>
<li><a href="http://validator.w3.org/check?uri=http%3A%2F%2Fpiotrdeszynski.com%2F">HTML5 Validator</a></li>
</ul>
</div><!-- /.blogroll -->
<div class="social">
<h2>social</h2>
<ul>
<li><a href="http://www.piotrdeszynski.com/feeds/all.atom.xml" type="application/atom+xml" rel="alternate">atom feed</a></li>
<li><a href="http://github.com/piteer1">github</a></li>
<li><a href="http://www.linkedin.com/pub/piotr-deszy%C5%84ski/14/762/17">linkedin.com</a></li>
</ul>
</div><!-- /.social -->
</section><!-- /#extras -->
<footer id="contentinfo" class="body">
<address id="about" class="vcard body">
Proudly powered by <a href="http://getpelican.com/">Pelican</a>, which takes great advantage of <a href="http://python.org">Python</a>.
</address><!-- /#about -->
<p>The theme is by <a href="http://coding.smashingmagazine.com/2009/08/04/designing-a-html-5-layout-from-scratch/">Smashing Magazine</a>, thanks!</p>
</footer><!-- /#contentinfo -->
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-35673065-1']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
<script type="text/javascript">
var disqus_shortname = 'yetanotherboringprogrammersblog';
(function () {
var s = document.createElement('script'); s.async = true;
s.type = 'text/javascript';
s.src = 'http://' + disqus_shortname + '.disqus.com/count.js';
(document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s);
}());
</script>
</body>
</html>