output's cache and performance - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: output's cache and performance (/showthread.php?tid=43893) |
output's cache and performance - El Forum - 07-27-2011 [eluser]Bad Penguin[/eluser] I am trying to use $this->output->cache(600) to reduce loading time of my pages. Is there a way to check if the served page has been generated from the cache or its a full live php codeigniter page? I'm getting always 2.200 seconds as loading time. The same version of the page as static HTML takes 0.043 seconds. I wonder what is taking so much time: - apache+php itself - $this->output->cache(600); placeced in wrong position (i have it in MY_Controller.php) - something else Any suggestions? output's cache and performance - El Forum - 07-27-2011 [eluser]toopay[/eluser] In real world/life performance, there are three core elements you should concern : Time To First Byte (which generally represent your server hardware/resources), good designed database and efficient caching schema(text and image compression, static resource cache and so on). output's cache and performance - El Forum - 07-27-2011 [eluser]tomcode[/eluser] 0. Make sure Your cache path is correct (application/config.php) and the cache folder is writable 1. It does not matter were You call $this->output->cache(600), as long as it get's executed 2. to check what's going on, set the log threshold to 2 in application/config.php For the fist run Your log should show You Code: .. For the second and subsequent runs You should see Code: .. output's cache and performance - El Forum - 07-27-2011 [eluser]toopay[/eluser] @tomcode, just wondering why you give an obvious knowledge of how to turn on the CI Log, while he asking about (or at least his concern is) app performance? [quote author="Bad Penguin" date="1311774216"]I am trying to use $this->output->cache(600) to reduce loading time of my pages. ... I wonder what is taking so much time: - apache+php itself - $this->output->cache(600); placeced in wrong position (i have it in MY_Controller.php) - something else Any suggestions?[/quote] output's cache and performance - El Forum - 07-28-2011 [eluser]tomcode[/eluser] @toopay maybe I did not understand the question, but to me he is asking : Quote:Is there a way to check if the served page has been generated from the cache or its a full live php codeigniter page? This I can see by consulting the log as I have described, no ? Wondering what takes so much time is to me a second step, after I have checked wether the cache is working. I find it hard to evaluate the background (what is obvious) of the person posting, so I describe all steps ... output's cache and performance - El Forum - 07-28-2011 [eluser]Mirge[/eluser] [quote author="tomcode" date="1311852322"]@toopay maybe I did not understand the question, but to me he is asking : Quote:Is there a way to check if the served page has been generated from the cache or its a full live php codeigniter page? This I can see by consulting the log as I have described, no ? Wondering what takes so much time is to me a second step, after I have checked wether the cache is working. I find it hard to evaluate the background (what is obvious) of the person posting, so I describe all steps ...[/quote] That's what I read & thought as well. toopay jumped the gun, IMO To the OP: were you able to figure out if caching is working? output's cache and performance - El Forum - 07-28-2011 [eluser]Bad Penguin[/eluser] Thank for your time to providing me such long answer. [quote author="tomcode" date="1311842367"] 1. It does not matter were You call $this->output->cache(600), as long as it get's executed [/quote] Ok, tought i had to put that libraries call before anything else. [quote author="tomcode" date="1311842367"] 2. to check what's going on, set the log threshold to 2 in application/config.php DEBUG - 2011-07-28 05:28:27 --> Total execution time: 0.0572 [/quote] Ok its working now, is 0.0206 acceptable PHP side or i should use a different cache driver like APC/Memcache instead of file? Client side the page i 9KB and takes 125-250ms to fully download. Before: Code: DEBUG - 2011-07-28 14:16:39 --> Cache file written: app/cache/83f9965d673372c75a2cd29befb94aef After: Code: DEBUG - 2011-07-28 14:19:29 --> Final output sent to browser output's cache and performance - El Forum - 07-28-2011 [eluser]Bad Penguin[/eluser] [quote author="toopay" date="1311844063"]@tomcode, just wondering why you give an obvious knowledge of how to turn on the CI Log, while he asking about (or at least his concern is) app performance? [quote author="Bad Penguin" date="1311774216"]I am trying to use $this->output->cache(600) to reduce loading time of my pages. ... I wonder what is taking so much time: - apache+php itself - $this->output->cache(600); placeced in wrong position (i have it in MY_Controller.php) - something else Any suggestions?[/quote][/quote] In the end he was right, i've MY_Output class that will bypass cache if the client IP is from our development office. I'll check tonight from home again |