Trying to figure out why index.php is loading so slow Trying to figure out why index.php is loading so slow
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

Trying to figure out why index.php is loading so slow

Started by dke, July 15, 2006, 10:13:20 PM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

dke

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


Sami

- enable debug mode for all
- post a link to your gallery
‍I don't answer to PM with support question
Please post your issue to related board

dke

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!

Sami

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
‍I don't answer to PM with support question
Please post your issue to related board

dke

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?

dke

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?

Nibbler

That's not the query for last additions, it looks like something to do with album stats.

dke

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.

Sami

sorry , you're right , as documantation said:
This query will fetch album stats and keyword for the albums
‍I don't answer to PM with support question
Please post your issue to related board

dke

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

Sami

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 ;)
‍I don't answer to PM with support question
Please post your issue to related board

dke

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); */

Sami

this trick should remove it !!!
your gallery is offline for me !!!
is this cause of commenting out that query, or you did that?
‍I don't answer to PM with support question
Please post your issue to related board

dke

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 :)

Nibbler

The query is in the code twice, under list_albums and list_cat_albums. Remove both.

dke

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