Re: [fw-general] ZF - APC tuning
Hi Renan, you need to install a driver and after you install it, you'll get a new drive in your pc, but the files you store in there will be on ram and not in a real disk, here is a tutorial on how to do it. Hope it helps, Aldemar Saludos desde Bogotá - Original Message - From: Renan Gonçalves To: Aldemar Bernal Cc: fw-general@lists.zend.com Sent: Wednesday, April 09, 2008 9:22 PM Subject: Re: [fw-general] ZF - APC tuning Sorry for my newbie question, but.. How I can put a application to run on ramdisk? There are some tutorials or articles about it? Thanks man! On 4/5/08, Aldemar Bernal <[EMAIL PROTECTED]> wrote: Hi everyone, 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). Regards, Aldemar -- Renan Gonçalves - Software Engineer Cell Phone: +55 11 8633 6018 MSN: [EMAIL PROTECTED] São Paulo - SP/Brazil
Re: [fw-general] ZF - APC tuning
Sorry for my newbie question, but.. How I can put a application to run on ramdisk? There are some tutorials or articles about it? Thanks man! On 4/5/08, Aldemar Bernal <[EMAIL PROTECTED]> wrote: > > Hi everyone, > > 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). > > > Regards, > > Aldemar > -- Renan Gonçalves - Software Engineer Cell Phone: +55 11 8633 6018 MSN: [EMAIL PROTECTED] São Paulo - SP/Brazil
Re: [fw-general] ZF - APC tuning
re 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/x/ (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: 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 se
Re: [fw-general] ZF - APC tuning
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]>: > 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]> > 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/x/ (before running this command I > > opened > > twice the page in order that apc cached w/o fragmenting the fil
Re: [fw-general] ZF - APC tuning
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]> 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/x/ (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]> > To: > Sent: Saturday, April 05, 2008 6:10 PM > Subject: Re: [fw-general] ZF - APC tuning > > > > -- Aldemar Bernal <[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 >
Re: [fw-general] ZF - APC tuning
Teemu, Jurrien also suggested me to have a huge require_once file, I haven't tested yet. Aldemar - Original Message - From: "Teemu Välimäki" <[EMAIL PROTECTED]> To: Sent: Monday, April 07, 2008 2:06 PM Subject: Re: [fw-general] ZF - APC tuning On Monday 07 April 2008 21:02:53 Aldemar Bernal wrote: Still sucks, doesn't it :P Yes. I found, that in my VPS APC nor xcache do not help much. I'm yet to test APC fully, but I'm not hoping much. Few months ago I stumbled on a fellow who had tested creating one HUGE bootstrap with all the requires. Have you tested this idea with cachers/optimizers? Maybe bootstrap should contain bootsections "dynamic" and "static", where dynamic means files to be loaded on-the-fly and static some huge or large with as little as possible dynamically loaded files. ZF itself could generate this static file.. something like Zend_Cache. Identification of the section would happen by Route. Crazy idea? -- Teemu Valimaki <[EMAIL PROTECTED]>
Re: [fw-general] ZF - APC tuning
On Monday 07 April 2008 21:02:53 Aldemar Bernal wrote: > Still sucks, doesn't it :P Yes. I found, that in my VPS APC nor xcache do not help much. I'm yet to test APC fully, but I'm not hoping much. Few months ago I stumbled on a fellow who had tested creating one HUGE bootstrap with all the requires. Have you tested this idea with cachers/optimizers? Maybe bootstrap should contain bootsections "dynamic" and "static", where dynamic means files to be loaded on-the-fly and static some huge or large with as little as possible dynamically loaded files. ZF itself could generate this static file.. something like Zend_Cache. Identification of the section would happen by Route. Crazy idea? -- Teemu Valimaki <[EMAIL PROTECTED]>
Re: [fw-general] ZF - APC tuning
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/x/ (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]> To: Sent: Saturday, April 05, 2008 6:10 PM Subject: Re: [fw-general] ZF - APC tuning -- Aldemar Bernal <[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] Zend - The PHP Company | http://www.zend.com/
Re: [fw-general] ZF - APC tuning
Matthew Weier O'Phinney-3 wrote: > > First, I'm assuming you're using apache with mod_php. On windows, my > understanding is that this simply doesn't perform terribly well. > Yeah, I was getting similar results - MS Windows file system performance is poor. Check out this thread and particularly this post which includes expected unix performance: http://www.nabble.com/RE%3A-ZF-performance-advice-p13285168.html -- View this message in context: http://www.nabble.com/ZF---APC-tuning-tp16517188p16536331.html Sent from the Zend Framework mailing list archive at Nabble.com.
Re: [fw-general] ZF - APC tuning
-- Aldemar Bernal <[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] Zend - The PHP Company | http://www.zend.com/
Re: [fw-general] ZF - APC tuning
Hi Aldemar, One way to get (significant) speed gains with APC is by pre-loading various classes. See http://www.zym-project.com/reference Appendix A for a list of often used files that you can require_once manually. How and why this works can be found on this list iirc and somewhere around the interwebs ;) (sorry, falling asleep atm, so I don't feel like explaining it all right now ;) Cheers Jurriën On Apr 5, 2008, at 9:40 PM, Aldemar Bernal wrote: Hi everyone, 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). Regards, Aldemar