Re: [PHP] PreCaching Db into Variables Slows it down?!??
That's an expansive reply! Cheers Peter Since I had to alter the db (quite simply) to include this tweak, I thought best to do it now in dev phase (and keep it as an option), that mess around with it later when lots of data exists. It's my own code, and benchmarks show it to perform fast. However, in due course I will try the Smarty template system, and compare it to that, but from what (little) I've read on the subject, I don't know if it's best suited to my needs (although the cache system sounds nice!). You're right, it is early to be worrying about optimisation, but I tend to get a bit obsessive about it. I take the view it's best to get it at least half right during development phase, than make a mess and spend a lot longer trying to rework production code. You sound like you have some experience though, whats a decent page load time? (from start of script to end of script)? I'm aiming for sub 0.1 seconds, on IIS5 (it will be moved to RedHat for production). Thanks for you input, interesting read! Andy > I bet someone would have to look at the code. Are you writing your own code or just gluing modules together? I'm using the > Smarty template system which I really like, it caches templates. > > Personally I think you are going overboard in trying to optimize at this point. I assume that your system is working, and so you > need only tweak it. But it sounds as if you are still working out what the system is. > > I have not done much work on High Traffic sites. One site was a skater site and big food producer was running a promo and > had TV ads ... site performed fine even though it was just plain cgi scripts hitting mysql at least 5 times for just about every > page (I did not write the site but I had to modify,watch it). > > Another site was marked as troublesome, big book publisher. They just threw hardware at it and all was well. > > Now Yahoo ... or Google ... that would be interesting. Why create a solution for no problem? I'd suggest looking at your > templating system. Which one are you using? You didn't create your own did you? > > Peter > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PreCaching Db into Variables Slows it down?!??
On 12 Sep 2002 at 1:35, M1tch wrote: > Just spent ages (well, 2hours) on a precaching system for my PHP code > that didn't work out! Hang on, I'll backtrack a bit... > > My website is using a php engine that picks at snippets of html from the > database, and builds them up to form the page. A typical page may use 5 > of these html snippets, each at maybe 5kb in size. > > I was sat thinking, looking at the debug-timer, and saw that the > templates were one of the more time consuming aspects. So I said, I > know, I'll save the db a bit, and at the start of the script, read all > the templates that I'll need into a global variable, and call them from > that. Simple, 5 db calls put into 1, and templates taken out of memory. > > So why, oh why, has the time taken actually increased??? Does anyone > have sufficient working knowledge of PHP to give me a hint at why this > has happened? I bet someone would have to look at the code. Are you writing your own code or just gluing modules together? I'm using the Smarty template system which I really like, it caches templates. Personally I think you are going overboard in trying to optimize at this point. I assume that your system is working, and so you need only tweak it. But it sounds as if you are still working out what the system is. I have not done much work on High Traffic sites. One site was a skater site and big food producer was running a promo and had TV ads ... site performed fine even though it was just plain cgi scripts hitting mysql at least 5 times for just about every page (I did not write the site but I had to modify,watch it). Another site was marked as troublesome, big book publisher. They just threw hardware at it and all was well. Now Yahoo ... or Google ... that would be interesting. Why create a solution for no problem? I'd suggest looking at your templating system. Which one are you using? You didn't create your own did you? Peter -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PreCaching Db into Variables Slows it down?!??
Grrr! Just spent ages (well, 2hours) on a precaching system for my PHP code that didn't work out! Hang on, I'll backtrack a bit... My website is using a php engine that picks at snippets of html from the database, and builds them up to form the page. A typical page may use 5 of these html snippets, each at maybe 5kb in size. I was sat thinking, looking at the debug-timer, and saw that the templates were one of the more time consuming aspects. So I said, I know, I'll save the db a bit, and at the start of the script, read all the templates that I'll need into a global variable, and call them from that. Simple, 5 db calls put into 1, and templates taken out of memory. So why, oh why, has the time taken actually increased??? Does anyone have sufficient working knowledge of PHP to give me a hint at why this has happened? Also, am I right in thinking that as the website hits increase, the db will be put under increasing pressure, so it serves off better being called only once instead of 5 times (Even though more data is taken out of it??). It's late, my eyes are blurring, and I'm annoyed. Very annoyed! Regards, Andy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php