Please take one thing on consideration : when using Windows to
benchmark , turn your AV and all those kind of services OFF.
I ran an APC test as well on Windows ( for fun ), and with / without
my AntiVirus solution ==> I got twice more requests per second without
it !!
I ran an ab with something like -n 80 -c 40 , (no DB, no session ),
results were poor, but that is an OS problem , Windows is not good at
all to support such PHP apps ( in fact it 'may' be, but a Windows
developer platform cant give good results).
With APC, I got about twice more requests served than without.
I noticed as well that APC should be fined configured. 1 or 2 more MB
for the memory segment can improve / degrade performance with a big
factor.....
Conclusion : do test on Windows if you want, but dont be surprised if
you have (very) poor performance results. There are several Windows
services that can knock the performance, not talking about the so bad
File System.
(you should try to put your session data in memory such as memcache
for tests as well)
Cheers
Julien.P
2008/4/8 James Dempster <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>>:
I also get the same kind of results on Windows, installing APC for
me actually slows down the requests. My PC is dual booted so I
tested the setup in Ubuntu Linux which was so amazingly fast.
*Tested on: *Intel Dual Core 2.8GHz, 4GB RAM etc etc
*Tested using: *ab -n 2000 http://localhost/ (No concurancy cause
we're testing response speed not server load)
Website tested usues the following (but not limited to) ZF
components MVC including Modules, Zend_Db + Db_Table etc (metadata
cached in Zend_Cache sqlite), Zend_Config_Ini, Zend_Registry,
Zend_Log, Zend_Session and all classes associated with them. Some
custom models. So it's a fairly good senario. There's no extra
caching other than the Zend_Db_Table metadata.
Windows XP Pro SP2, Apache2 mod_php = 450ms
Windows XP Pro SP2, Apache2 mod_php + apc = 500ms
Ubuntu Linux 7.10, Apache2 mod_php = 150ms
Ubuntu Linux 7.10, Apache2 mod_php + apc = 50ms
This goes to show that ZF is not at fault here. I'm not even sure
if Windows is at fault as I've heard great results about the new
php fast cgi + iis 6.
It just seems that Apache + PHP + Windows is a bad mix (for
production).
--
/James
On Mon, Apr 7, 2008 at 7:02 PM, Aldemar Bernal
<[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>> wrote:
Well,
after a weekend of testing I found that:
- fastcgi (using zend core fastcgi and other fastcgi) didn't
give me better
results than using the mod_php, I couldn't test using IIS
since I don't have
it =P
- apc and xcache with fastcgi gave always trouble when
benchmarking using ab
from apache (php crashed all the times).
- turning off apc.stat really boost my code, but I had to
change some things
(relative require_once to absolute require_once using
dirname(__FILE__))
- it seems that even if apc.stat is turned off, it access the
disk (well,
obviously it does the first time it caches the files) because
ramdisk still
faster than using my files on my harddrive, it should be
faster only the
first time, but it's faster all the times (I checked out
apc.php and I found
that apc was already caching the files).
- concluding, I'll use here in my dev laptop mod_php + apc
with apc.filters
filtering and caching only ZF files (in a ramdisk) and my
customers windows
servers I'll use mod_php + apc with apc.stat always off (maybe
including the
ramdisk thingy).
Times:
- fastcgi ~700ms
- fastcgi + accelerator (apc or xcache) ~ 600ms
- mod_php alone ~ 500ms
- mod_php + apc + files in ramdisk ~ 300ms
- mod_php + apc + apc.stat = 0 ~ 300ms
- mod_php + apc + apc.stat = 0 + files in ramdisk ~ 110ms
- mod_php + apc + apc.stat = 0 + apc.filtering (only caching
ZF) + files in
ramdisk (only ZF) ~ 280ms
Again my setup is:
- apache 2.2 (mod_php)
- php 5.2.5
- apc 3.0.17-dev
- zf 1.5.1
- windows xp home
Still sucks, doesn't it :P
btw, I couldn't any documentation about apc caching classes
(maybe you were
talking about user cache), the command I use to benchmark was:
ab -c 5 -n 20 http://localhost/xxxxx/ (before running this
command I opened
twice the page in order that apc cached w/o fragmenting the files)
The page I used did connect to a DB but doing nothing but a
'SET NAMES utf8'
query, and disabling it didn't show any difference.
Aldemar
----- Original Message ----- From: "Matthew Weier O'Phinney"
<[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>>
To: <fw-general@lists.zend.com <mailto:fw-general@lists.zend.com>>
Sent: Saturday, April 05, 2008 6:10 PM
Subject: Re: [fw-general] ZF - APC tuning
-- Aldemar Bernal <[EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]>> wrote
(on Saturday, 05 April 2008, 02:40 PM -0500):
I've been trying to make my app perform better, every
request takes (according
ab: apache stress tool) ~510ms, which is a lot!, over
half second in every
request?, so I installed and enabled APC but surprisly
it performed even worst
than w/o APC, ~650ms per request. Any of you have
tried using APC w/ ZF?
The best results I had was using a RAM Disk, putting
in it only zf it perform
~420ms and w/ the app ~330ms.
My setup is:
- apache 2.2
- php 5.2.5
- apc 3.0.17-dev
- zf 1.5.1
- windows xp home
With the best configuration (zf and app running from
ram disk) and using apc
returns the same results ~330ms (so, no difference at
all when using it from a
ramdisk).
A few things to note.
First, I'm assuming you're using apache with mod_php. On
windows, my
understanding is that this simply doesn't perform terribly
well. You may
get better results with IIS+FastCGI (heck, you might try
FastCGI with
apache to see if that goes better, too). Regardless,
Windows and Mac
environments tend not to get you your best performance,
though.
Second, IIRC, APC allows you to preload classes. I'd recommend
investigating that option.
Third, how many requests are you benching? You need to run
a fair number
of requests with APC to ensure that the cache gets loaded
and that
you're actually hitting the cache (one or two requests
simply won't do
it). You may be already doing this, but you don't indicate
that fact in
your description.
Also, are you using a DB? or any web services? These may
also be
contributing to the lag you're seeing.
I've benched some barebones apps in the past, as has Paul
M. Jones, and
the fact of the matter is that frameworks tend to be
performance hogs,
even when serving simple "Hello World" style pages. That
said, being
able to handle only 1 or 2 requests per second sounds
seriously slow,
and I know that most apps I've done with ZF perform much
better than
that... particularly when using good caching strategies
and not hitting
a DB or web service.
--
Matthew Weier O'Phinney
Software Architect | [EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]>
Zend - The PHP Company | http://www.zend.com/