guarriman Posted February 29, 2008 Share Posted February 29, 2008 Hi. Working with PHP5, I'm suffering an odd issue with the load of my website, which is an application allowing users to register and to post question in a kind of forum/bboard. It's made with some PHP classes I created (they write/read to/from mySQL tables), and uses Smarty. But the first time one user access any webpage, it takes 5-10 seconds to load. Then the rest of pages visited by the same user go really fast, so I'm wondering what's wrong with my PHP app. Do you have similar experiences? I'm considering: - Smarty takes some seconds to compile - App takes some second to handle session variables (I use a lot of them) Any suggestion is welcome. Thank you very much, --mark Quote Link to comment Share on other sites More sharing options...
trq Posted February 29, 2008 Share Posted February 29, 2008 Pretty hard to say where your bottle neck may be without seeing any code. I can assure you that php itself is not slow however template engines on the other hand are notoriously so. Quote Link to comment Share on other sites More sharing options...
guarriman Posted February 29, 2008 Author Share Posted February 29, 2008 Hi thorpe. Thank you very much for your answer. My app has tons of PHP code (20 classes, 100 Smarty templates, 100 PHP webpages). I thought that Smarty was useful to save time, not to waste it Quote Link to comment Share on other sites More sharing options...
aschk Posted February 29, 2008 Share Posted February 29, 2008 Sounds like the first load is smarty doing its stuff, then the subsequent loads are cached Is it possible that your classes are hammering the database with lots of queries? Quote Link to comment Share on other sites More sharing options...
guarriman Posted February 29, 2008 Author Share Posted February 29, 2008 Is it possible that your classes are hammering the database with lots of queries? Yep. It's possible... For each class, I harvest all the fields of the record I query Thank you very much for the answer. Quote Link to comment Share on other sites More sharing options...
aschk Posted February 29, 2008 Share Posted February 29, 2008 Put some timers around your SQL queries and find out how long they're taking... Put a timer around your whole script. Check your SQL slow query log. Give us the table layouts, and indexes (<- biggest problem with DB queries is lack of indexes) Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted February 29, 2008 Share Posted February 29, 2008 A request for any one web page should only cause the code and data necessary for that one web page to be parsed/executed/loaded/or created. If you have somehow done this so that all code is loaded and parsed when any page is requested, rethink what you have done. The only way anyone in a forum can specifically help you is if you provide specific details. So far the information you have provided is fairly vague and won't get you anything but guesses as to what the problem is. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.