coppermine-gallery.com/forum

Support => cpg1.5.x Support => cpg1.5 miscellaneous => Topic started by: profili on January 20, 2011, 04:01:33 PM

Title: Server performance problems after upgrade
Post by: profili on January 20, 2011, 04:01:33 PM
After upgrading one of my quite popular  galleries to the 1.5.12 version the server is going crazy. Downtimes every day, and the traffic is the same or less than before the upgrade.
The only thing I could think about these problems is that CPG 1.5 is giving a lot of url-s for the same content. Before the upgrade, with cpg 1.4.x i used to use this hack (http://forum.coppermine-gallery.net/index.php/topic,49953.0.html), and as I said no server problems before the upgrade. Maybe this makes troubles when a CPG driven gallery has thousands of visitors everyday. Because the visitor gets different urls when visiting the last uploaded files, or last commented files, or filmstrip files ect ect and the server can't handle this very good.

What I need to test with the hope that this will solve my performance problems is to have unique urls sitewide, no matter from where a image is viewed. I know that my gallery will have less functionality after this, but for me is more important to have the site online than a lot of functionalities.

http://www.galsh.com/

Regards.
Title: Re: Server performance problems after upgrade
Post by: Αndré on January 20, 2011, 05:03:07 PM
The hack is similar in cpg1.5.x (but I haven't tested that).

Copy the whole function theme_display_thumbnails from themes/sample/theme.php to your theme's theme.php file, find
               } elseif ($aid == 'random') {
                   $target = "displayimage.php?pid={$thumb['pid']}$uid_link#top_display_media";
               } elseif ($aid == 'lastcom' || $aid == 'lastcomby') {
                   $page = cpg_get_comment_page_number($thumb['msg_id']);
                   $page = (is_numeric($page)) ? "&page=$page" : '';
                   $target = "displayimage.php?album=$aid$cat_link$date_link&pid={$thumb['pid']}$uid_link&msg_id={$thumb['msg_id']}$page#comment{$thumb['msg_id']}";
               } else {
                   $target = "displayimage.php?album=$aid$cat_link$date_link&pid={$thumb['pid']}$uid_link#top_display_media";
               }

and replace with
               } else {
                   $target = "displayimage.php?pid={$thumb['pid']}#top_display_media";
               }



For the filmstrip you need to modify the function theme_display_film_strip. Find
           } elseif ($aid == 'lastcom' || $aid == 'lastcomby') {
               $page = cpg_get_comment_page_number($thumb['msg_id']);
               $page = (is_numeric($page)) ? "&page=$page" : '';
               $target = "displayimage.php?album=$aid$cat_link$date_link&pid={$thumb['pid']}$uid_link&msg_id={$thumb['msg_id']}$page#comment{$thumb['msg_id']}";
           } else {
               $target = "displayimage.php?album=$aid$cat_link$date_link&pid={$thumb['pid']}$uid_link#top_display_media";
           }

and replace with
           } else {
               $target = "displayimage.php?pid={$thumb['pid']}#top_display_media";
           }

(or just disable the filmstrip).
Title: Re: Server performance problems after upgrade
Post by: profili on January 21, 2011, 01:06:29 AM
Thank you. Great Great Great.
Αndré, with you around Coppermine forums are a better place.

Cheers.
Title: Re: Server performance problems after upgrade
Post by: Αndré on January 21, 2011, 08:57:20 AM
So your problem is solved? If so, please
Quote from: Joachim Müller on September 28, 2008, 12:46:26 PM
Resolve your threads
you can tag your answer as "solved" by clicking on the little image in your initial posting on your thread.
Title: Re: Server performance problems after upgrade
Post by: Jokke_K on January 21, 2011, 08:34:02 PM
Thank you, this works. We had similar performance issues and this mod decreased server load dramatically.
Title: Re: Server performance problems after upgrade
Post by: profili on January 22, 2011, 12:29:19 AM
The same thing here. Since yesterday the server is running smoothly.
Title: Re: Server performance problems after upgrade
Post by: profili on January 25, 2011, 11:36:32 PM
I noticed now that the navigation butons, previous, next images, skip to end, are still producing alternative urls. Can you help to fix this too? Thank you.
Title: Re: Server performance problems after upgrade
Post by: Αndré on January 26, 2011, 09:05:21 AM
Copy the whole function theme_html_img_nav_menu from themes/sample/theme.php to your theme's theme.php file, find
$start_tgt = "$CPG_PHP_SELF?album=$album$cat_link$date_link&pid={$pic_data[$start]['pid']}";
and replace with
$start_tgt = "$CPG_PHP_SELF?pid={$pic_data[$start]['pid']}";

find
        if ($album == 'lastcom' || $album == 'lastcomby') {
            $page = cpg_get_comment_page_number($pic_data[$prev]['msg_id']);
            $page = (is_numeric($page)) ? "&page=$page" : '';
            $prev_tgt = "$CPG_PHP_SELF?album=$album$cat_link$date_link&pid={$pic_data[$prev]['pid']}$uid_link&msg_id={$pic_data[$prev]['msg_id']}$page#comment{$pic_data[$prev]['msg_id']}";
            $start_tgt .= "$uid_link&msg_id={$pic_data[$start]['msg_id']}$page#comment{$pic_data[$start]['msg_id']}";
        } else {
            $prev_tgt = "$CPG_PHP_SELF?album=$album$cat_link$date_link&pid={$pic_data[$prev]['pid']}$uid_link#top_display_media";
            $start_tgt .= "$uid_link#top_display_media";
        }

and replace with
        $prev_tgt = "$CPG_PHP_SELF?pid={$pic_data[$prev]['pid']}#top_display_media";
        $start_tgt .= "#top_display_media";


find
$end_tgt = "$CPG_PHP_SELF?album=$album$cat_link$date_link&pid={$pic_data[$end]['pid']}";
and replace with
$end_tgt = "$CPG_PHP_SELF?pid={$pic_data[$end]['pid']}";

find
        if ($album == 'lastcom' || $album == 'lastcomby') {
            $page = cpg_get_comment_page_number($pic_data[$next]['msg_id']);
            $page = (is_numeric($page)) ? "&page=$page" : '';
            $next_tgt = "$CPG_PHP_SELF?album=$album$cat_link$date_link&pid={$pic_data[$next]['pid']}$uid_link&msg_id={$pic_data[$next]['msg_id']}$page#comment{$pic_data[$next]['msg_id']}";
            $end_tgt .= "$uid_link&msg_id={$pic_data[$end]['msg_id']}$page#comment{$pic_data[$end]['msg_id']}";
        } else {
            $next_tgt = "$CPG_PHP_SELF?album=$album$cat_link$date_link&pid={$pic_data[$next]['pid']}$uid_link#top_display_media";
            $end_tgt .= "$uid_link#top_display_media";
        }

and replace with
        $next_tgt = "$CPG_PHP_SELF?pid={$pic_data[$next]['pid']}#top_display_media";
        $end_tgt .= "#top_display_media";
Title: Re: Server performance problems after upgrade
Post by: profili on January 26, 2011, 12:19:55 PM
Just implemented these changes. Working greatly. Thank you again.