![]() |
too slow, ~12 sec for load - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: too slow, ~12 sec for load (/showthread.php?tid=32549) |
too slow, ~12 sec for load - El Forum - 07-27-2010 [eluser]davidino86[/eluser] second part Code: function bestAds() too slow, ~12 sec for load - El Forum - 07-27-2010 [eluser]davidino86[/eluser] i was thinking about the autoload configuration, but i don't know. i've insert the cache control to 5 minutes and it solve temporarily the problem too slow, ~12 sec for load - El Forum - 07-27-2010 [eluser]mddd[/eluser] With this kind of slow loads, I think the problem must be looked for in the database connection. There is no way the execution of the scripts themselves can be that slow (unless you write REALLY bad code). It could be that you are doing some bad queries that take a long time, or it can be that the server is almost overloaded so that you have to wait a long time before the database returns anything useful. I don't see any profiler info, but I think you should focus on the database queries in the profiler and see which take a long time. Then check if there is an optimization problem in those queries, or that the database is just too slow.. which can happen in shared hosting packages, especially on budget-providers. too slow, ~12 sec for load - El Forum - 07-27-2010 [eluser]davidino86[/eluser] what do you mean for looking for in the database connection. Now i put the p_connect to false because everytime you go to another page the php opens a new connection and stay opened for the rest of navigation. the heaviest query takes 0.0291 sec and it's an "update" query. anyway i see the profiler now. what do you think about the class of the home controller? too slow, ~12 sec for load - El Forum - 07-27-2010 [eluser]mddd[/eluser] I meant checking the queries like you did. I just can't imagine which piece of code could take so long. The controller is really only loading pieces of information and displaying them. Nothing special there that should take that long. You could try and find out more details by putting in some benchmark points. For instance at the beginning and end of each function. To find out which parts take the longest. Check out the profiler/benchmark classes to find examples of this. too slow, ~12 sec for load - El Forum - 07-27-2010 [eluser]Xperia[/eluser] Just had a quick look, you have a lot of DB queries that do add upp, like: Code: 0.0006 SELECT Impressions You should just do it with just one DB statement, like: Code: UPDATE AdvertisingBanner SET Impressions = Impressions+1 WHERE ID_Banner = 'AC72C24A-045E-4638-9387-5990546DE55F' too slow, ~12 sec for load - El Forum - 07-27-2010 [eluser]davidino86[/eluser] i'll do it and i'll let you know too slow, ~12 sec for load - El Forum - 07-27-2010 [eluser]davidino86[/eluser] [quote author="Xperia" date="1280255340"]Just had a quick look, you have a lot of DB queries that do add upp, like: Code: 0.0006 SELECT Impressions You should just do it with just one DB statement, like: Code: UPDATE AdvertisingBanner SET Impressions = Impressions+1 WHERE ID_Banner = 'AC72C24A-045E-4638-9387-5990546DE55F' the second query i apart from the first and it 's like you wrote too slow, ~12 sec for load - El Forum - 07-27-2010 [eluser]John_Betong[/eluser] Your site eventually displays in Opera but will not load with Firefox and Google Chrome. I looked at the source and discovered that you load thirteen style sheets and nineteen javascript files in the header section. Try moving all the javascript file to immediately before your </body>> and it should make the page load quite a bit faster. too slow, ~12 sec for load - El Forum - 07-27-2010 [eluser]Jelmer[/eluser] I'm kinda guessing there's a loop somewhere within your code that causes this. I had that a while back after changing something small and I found the cause by adding exit('something') and moving that statement down from the top until the pageload started to slow down instead of immediately showing the text. It might indeed also be caused by a slow loading stylesheet, but as I get an error saying script execution took too long it's probably the page itself that is the problem. |