forum.coppermine-gallery.net

Support => cpg1.4.x Support => Older/other versions => cpg1.4 miscellaneous => Topic started by: dke on July 15, 2006, 10:13:20 pm

Title: Trying to figure out why index.php is loading so slow
Post by: dke on July 15, 2006, 10:13:20 pm
Hi all,

My index.php seem to load real slow, and cpu goes to 100% , ive tested to remove all "The content of the main page" and that didnt lower the load time in one single bit. And no i dont have "random" thumbnail on.

The load time is about 3-4 seconds, still its high, cause when i go to thumbnails.php and display around 500 pictures in one sweep that is faster loaded then index.php without anything on, so im wondering if any php expert would have any tips how to look for stuff that might be taking time to load even tho its not needed on my page

Title: Re: Trying to figure out why index.php is loading so slow
Post by: Sami on July 16, 2006, 08:14:26 am
- enable debug mode for all
- post a link to your gallery
Title: Re: Trying to figure out why index.php is loading so slow
Post by: dke on July 16, 2006, 05:06:31 pm
url is -

im having my thoughs it might still be that i have so many pictures in the database, but just to clearify the speed of loading the main index.php will not go any faster buy disabeling all the pictures shown on the front page.

thanks for your help guys!
Title: Re: Trying to figure out why index.php is loading so slow
Post by: Sami on July 16, 2006, 05:18:31 pm
This is your issue:
51 queries in 3.875 seconds
- you need to disable {STATISTICS} (129544 files in 15 albums and 2 categories with 22 comments viewed 3850 times)
   SELECT sum(hits) FROM cpg147_pictures as p LEFT JOIN cpg147_albums as a ON p.aid=a.aid WHERE 1 (0.789s)
- you need to disable last additions
   SELECT a.aid, count( p.pid )  AS pic_count, max( p.pid )  AS last_pid, max( p.ctime )  AS last_upload, a.keyword FROM cpg147_albums AS a  LEFT JOIN cpg147_pictures AS p ON a.aid = p.aid AND p.approved =  'YES' WHERE a.aid IN (4, 3, 5, 6, 7, 8, 9, 10, 11, 12, 17)GROUP BY a.aid (2.234s)

in this way you have save 3 sec
hope it work for you
Title: Re: Trying to figure out why index.php is loading so slow
Post by: dke on July 16, 2006, 05:22:54 pm
thanks alot sir, ill get right on it! are all those things disabeled from administrators config panel, or do i have to dig around manually in the php files?
Title: Re: Trying to figure out why index.php is loading so slow
Post by: dke on July 16, 2006, 05:50:02 pm
weird, when i disable last additions and then check the debug i still have the string SELECT a.aid, count( p.pid )  AS pic_count, max( p.pid )  AS last_pid, max( p.ctime )  AS last_upload, a.keyword FROM cpg147_albums AS a  LEFT JOIN cpg147_pictures AS p ON a.aid = p.aid AND p.approved =  'YES' WHERE a.aid IN (4, 3, 5, 6, 7, 8, 9, 10, 11, 12, 17)GROUP BY a.aid (2.234s)

is the index loading settings from any other file then the one that i edit through the "config" admin page?
Title: Re: Trying to figure out why index.php is loading so slow
Post by: Nibbler on July 16, 2006, 05:57:43 pm
That's not the query for last additions, it looks like something to do with album stats.
Title: Re: Trying to figure out why index.php is loading so slow
Post by: dke on July 16, 2006, 06:02:59 pm
ive disabeled all stats in the admin.php page, but i still get updates when someone view a picture etc.

ive searched some threads and found that i might have to edit either theme.php or english.php (which is the only lang file i have) to fully remove these things, but the search citera the other threads have i cannot find within my files, either of them.
Title: Re: Trying to figure out why index.php is loading so slow
Post by: Sami on July 16, 2006, 06:05:32 pm
sorry , you're right , as documantation said:
This query will fetch album stats and keyword for the albums
Title: Re: Trying to figure out why index.php is loading so slow
Post by: dke on July 16, 2006, 06:15:11 pm
ive just successfully removed the stats from the mainpage, but this didnt change the fact that the query is still being made when index.php is loaded grr, need to get rid of that 2 second deelay! :) thanks for your continues help
Title: Re: Trying to figure out why index.php is loading so slow
Post by: Sami on July 16, 2006, 06:17:24 pm
okey I disable that query in my test bed and nothing bad happen!!!!!
I don't have too many pics and album on my test bed so I can't say anything about effect of disabling that query , you can test it by your self:
open up index.php
around line 458 , you should add /* and go to line 465 and add a */ at the end of line
I hope one of DEV's team member help us ;)
Title: Re: Trying to figure out why index.php is loading so slow
Post by: dke on July 16, 2006, 06:34:58 pm
i think i did what you told me, and the query still remains in the debug log

index.php looking like this from row 458 to 465

/* $sql = "SELECT a.aid, count( p.pid )  AS pic_count, max( p.pid )  AS last_pid, max( p.ctime )  AS last_upload, a.keyword" .
            " FROM {$CONFIG['TABLE_ALBUMS']} AS a " .
            " LEFT JOIN {$CONFIG['TABLE_PICTURES']} AS p ON a.aid = p.aid AND p.approved =  'YES' ".
            "WHERE a.aid IN $album_set" . "GROUP BY a.aid";

    $alb_stats_q = cpg_db_query($sql);
    $alb_stats = cpg_db_fetch_rowset($alb_stats_q);
    mysql_free_result($alb_stats_q); */
Title: Re: Trying to figure out why index.php is loading so slow
Post by: Sami on July 16, 2006, 06:37:52 pm
this trick should remove it !!!
your gallery is offline for me !!!
is this cause of commenting out that query, or you did that?
Title: Re: Trying to figure out why index.php is loading so slow
Post by: dke on July 16, 2006, 06:40:26 pm
its up now, i had gallery offline mode on, cause i didnt want people to surf it while i was trying to fix this, ive added the /* and */ to the index.php on the correct line, the query did not get removed from the debug log, its still there consuming around 2.2 seconds of time

thanks alot for your help :)
Title: Re: Trying to figure out why index.php is loading so slow
Post by: Nibbler on July 16, 2006, 06:48:35 pm
The query is in the code twice, under list_albums and list_cat_albums. Remove both.
Title: Re: Trying to figure out why index.php is loading so slow
Post by: dke on July 16, 2006, 06:52:03 pm
sweet ! its gone!

Page generated in 2.058 seconds - 37 queries in 1.759 seconds - Album set : ; Meta set: ;

better then 3,8 or what it was before :) thanks alot guys