4images Forum & Community

4images Issues / Ausgaben => Discussion & Troubleshooting => Topic started by: rohanrohanrohan on June 04, 2003, 08:06:51 PM

Title: Gallery VERY slow: Problem? Lots of users/images?
Post by: rohanrohanrohan on June 04, 2003, 08:06:51 PM
Hi guys

would appreciate if you could help.

I have a gallery and currently use it for vids and images. have around 2500 pics and 50 vids.

However the gallery runs very slowly whenever there are lots of users online. at peak times I get 35 simultantous users browsing and downloading.

anything higher than 20 users and the gallery slows down.

so can anyone suggest direct ways to improve the gallery speed as during peak times it takes an initital 20 seconds just to load the front page, even with my broadband connection.

My forums which is hosted on same server loads instantly, then again it only has around 5-10 users online at once.

plz plz suggest methods to make gallery faster.
Title: Gallery VERY slow: Problem? Lots of users/images?
Post by: V@no on June 04, 2003, 10:23:28 PM
first I'd turn off random image feature (u can find lots of posts around here with how to do so. or search for random_image)
also, if u use MOD "Random new images" then I'd restore that to default, that just shows new images.
Title: Gallery VERY slow: Problem? Lots of users/images?
Post by: rohanrohanrohan on June 04, 2003, 10:37:58 PM
Quote from: V@no
first I'd turn off random image feature (u can find lots of posts around here with how to do so. or search for random_image)
also, if u use MOD "Random new images" then I'd restore that to default, that just shows new images.


yep i have done that as that is the obvious thing that came to mind first. iit did make a small difference. but any other tips?
Title: Gallery VERY slow: Problem? Lots of users/images?
Post by: www.girls-on-bikes.com on June 04, 2003, 10:40:07 PM
Could you possibly provide a link so we can check it out?
Thanks
Title: Gallery VERY slow: Problem? Lots of users/images?
Post by: rohanrohanrohan on June 04, 2003, 10:48:20 PM
http://www.masalahome.com/gallery/

would appreciate any other help u guys can give to increase speed of gallery
Title: Gallery VERY slow: Problem? Lots of users/images?
Post by: rohanrohanrohan on June 04, 2003, 10:49:26 PM
this is the code i removed in the pages (random images)
____________________________________________________________

{if random_cat_image}
                  <table width="150" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td class="head2" height="20"> <img src="{template_url}/images/spacer.gif" alt="" width="4" height="4" />{lang_random_image}</td>
                    </tr>
                    <tr>
                      <td class="tablebgcolor"><img src="{template_url}/images/spacer.gif" alt="" width="1" height="1" /></td>
                    </tr>
                    <tr>
                      <td align="center" class="row1">
                        <br />
                        {random_cat_image}
                        <br />
                        <br />
                      </td>
                    </tr>
                    <tr>
                      <td class="tablebgcolor"><img src="{template_url}/images/spacer.gif" alt="" width="1" height="1" /></td>
                    </tr>
                  </table>
                  {endif random_cat_image}
Title: Gallery VERY slow: Problem? Lots of users/images?
Post by: www.girls-on-bikes.com on June 04, 2003, 10:53:43 PM
Yep, loaded very slow.
First thought, remove the code for your popups and see how it goes.
Second thought, how's your hosting?  Have you had any problems as far as speed (possibly server load) before?
Title: Gallery VERY slow: Problem? Lots of users/images?
Post by: V@no on June 04, 2003, 10:55:52 PM
Quote from: rohanrohanrohan
this is the code i removed in the pages (random images)

by removing it from template, doesnt do ANY good, 4images still generate the random images.
check in /includes/constants.php file for random image. set to 0 (there should be two define(..);
Title: Gallery VERY slow: Problem? Lots of users/images?
Post by: rohanrohanrohan on June 04, 2003, 10:57:04 PM
well hosting is fine as have a forums hosting on it and it runs fine even with 10 users online at once.

im not to worried about forum speed. its gallery speed as the gallery is becoming more and more popular.

as for popups that is not problem. i just added the popups about 2-3 days. gallery speed was slow before that anyways.

do i think removing the "new images" section would increase gallery speed?

any other suggestions
Title: Gallery VERY slow: Problem? Lots of users/images?
Post by: www.girls-on-bikes.com on June 04, 2003, 11:03:06 PM
Well, other than that, I really can't think of why the gallery as a whole might be slow.  It can't be pin-pointed to one particular feature of the gallery since the gallery is slow on every page (and most pages don't have the random image stuff, etc).

<opinion>I don't think it's a problem with the gallery.  My site doesn't get quite as many hits, but it still gets a decent chunk of traffic, and I have had no problems.  If you think about it, the script is just PHP and MySQL, which runs very fast.  I just dunno, but I don't think it's the script.</opinon>
Title: Gallery VERY slow: Problem? Lots of users/images?
Post by: rohanrohanrohan on June 04, 2003, 11:04:44 PM
Ah! thanks veno! done that change in constants.php.

well definitely saw speed increase. still are there any other suggestions? cause the gallery will grow more and more and if i can implement changes now it will be better for future growth

thanks for the help so far.
Title: Gallery VERY slow: Problem? Lots of users/images?
Post by: rohanrohanrohan on June 04, 2003, 11:07:21 PM
BTW i read on this forum that turning on/off gzip may have an effect.

i know turning it on will save bandwidth as pages will be compressed but wouldnt that increase server load as for every page requested the server has to run an extra command.

currently i have it turned on to compression level 5
Title: Gallery VERY slow: Problem? Lots of users/images?
Post by: www.girls-on-bikes.com on June 04, 2003, 11:08:31 PM
What about bandwidth being sucked dry by video downloads?
Would that be a possible source?
Title: Gallery VERY slow: Problem? Lots of users/images?
Post by: rohanrohanrohan on June 04, 2003, 11:12:55 PM
well yes thats an effect also. but i had vids before on the server anyways. yes i have added more vids than last time so more server load. but im just looking for ways to increase gallery db loading

also BTW my forums loads fast. actually it loads instantly hosted onsame server.
Title: Gallery VERY slow: Problem? Lots of users/images?
Post by: rohanrohanrohan on June 07, 2003, 03:08:17 PM
have made the changes suggested and gallery does run faster. but still anotceable slowness when 20+ users logged in. ive turned off guest browsing of caps also.

any other way to make gallery faster?
Title: Slow
Post by: cisiodon on June 07, 2003, 03:14:28 PM
Make indexes in another tables in MYSQL and use ADOdb CAche to increase speed.

I am running with more than 4000 images and Powered by ADOdb !

Mike
Title: Gallery VERY slow: Problem? Lots of users/images?
Post by: rohanrohanrohan on June 07, 2003, 03:36:19 PM
cisidon: can u provide a brief description of how to do that or a link to a tutorial explaining steps needed to do that
Title: Slow
Post by: cisiodon on June 07, 2003, 03:44:09 PM
Ya !!!

Below is an example hopw to use ADOdb ( http://php.weblogs/adodb) .

include("./pnadodb/adodb.inc.php");
 $ADODB_CACHE_DIR = 'd:\\temp';
 $db = NewADOConnection('mysql');
 $db->Connect("your_host", "user", "password", "Your_Database");
 if (isset($cache)) $rs = $db->CacheExecute(120,'select * from nuke_modules');
 else $rs = $db->CacheExecute('select * from nuke_modules');


 if (isset($cache)) $rs = $db->CacheExecute(120,'select * from nuke_postwrap_url');
 else $rs = $db->CacheExecute('select * from nuke_postwrap_url');


 if (isset($cache)) $rs = $db->CacheExecute(120,'select * from nuke_blocks');
else $rs = $db->CacheExecute('select * from nuke_blocks');


 if (isset($cache)) $rs = $db->CacheExecute(120,'select * from nuke_xforum_forums');
else $rs = $db->CacheExecute('select * from nuke_xforum_forums');

 if (isset($cache)) $rs = $db->CacheExecute(120,'select * from nuke_xforum_posts');
else $rs = $db->CacheExecute('select * from nuke_xforum_posts');

 if (isset($cache)) $rs = $db->CacheExecute(120,'select * from nuke_xforum_threads');
else $rs = $db->CacheExecute('select * from nuke_xforum_threads');

while (!$rs->EOF) {
$rs->MoveNext();
}


===============================
This  i am using with PostNuke, and to 4Images you change The Database, Tables you wish caching. You can also Cache All PIC_ID !!!

Insert this lines in index.php AT the BEgin after <? php .....


Regards from Brazil !!

Mike
Here caching about 120 Sec. Tables nuke_etc_etc....
Title: Gallery VERY slow: Problem? Lots of users/images?
Post by: rohanrohanrohan on June 07, 2003, 03:48:33 PM
thanks but where do i get the ("./pnadodb/adodb.inc.php) file from?

its not built into the gallery is it?
Title: Slow
Post by: cisiodon on June 07, 2003, 03:56:17 PM
You can get it at http://php.weblogs.com/adodb and download the latest version ( 270K ) .

Mike
Title: Gallery VERY slow: Problem? Lots of users/images?
Post by: rohanrohanrohan on June 07, 2003, 04:02:26 PM
thanks!! will try it out now. hopefully it will make adiference cause my gallery is growing too fast. have around 3000+ pics and 50 vids.

and around 2000 members
Title: Slow
Post by: cisiodon on June 07, 2003, 04:19:13 PM
Good Luck !!

Mike
Title: Gallery VERY slow: Problem? Lots of users/images?
Post by: rohanrohanrohan on June 07, 2003, 04:49:02 PM
DAMN!! safe mode error!!

does this work with safe mode!

i managed to by pass safe mode for the actuall gallery.

any way to do it for this adodb script?
Title: Slow
Post by: cisiodon on June 07, 2003, 06:00:14 PM
I my system I did not see this error.

If you set the TEMP dir for CAche you must give READ/WRITE permissions to it.

Mike
Title: Slow.
Post by: cisiodon on June 07, 2003, 06:09:34 PM
<?php
/**************************************************************************
 *                                                                        *
 *    4images - A Web Based Image Gallery Management System               *
 *    ----------------------------------------------------------------    *
 *                                                                        *
 *             File: index.php                                            *
 *        Copyright: (C) 2002 Jan Sorgalla                                *
 *            Email: jan@4homepages.de                                    *
 *              Web: http://www.4homepages.de                             *
 *    Scriptversion: 1.7                                                  *
 *                                                                        *
 *    Never released without support from: Nicky (http://www.nicky.net)   *
 *                                                                        *
 **************************************************************************
 *                                                                        *
 *    Dieses Script ist KEINE Freeware. Bitte lesen Sie die Lizenz-       *
 *    bedingungen (Lizenz.txt) für weitere Informationen.                 *
 *    ---------------------------------------------------------------     *
 *    This script is NOT freeware! Please read the Copyright Notice       *
 *    (Licence.txt) for further information.                              *
 *                                                                        *
 *************************************************************************/




include("./pnadodb/adodb.inc.php");
$ADODB_CACHE_DIR = 'd:\\temp';
$db = NewADOConnection('mysql');
 $db->Connect("xxx.xxx.xxx.xxx", "Any", "error", "4images");
 
if (isset($cache)) $rs = $db->CacheExecute(14400,'select * from 4images_images');
 else $rs = $db->CacheExecute('select * from 4images_images');
if (isset($cache)) $rs = $db->CacheExecute(72000,'select * from 4images_categories');
else $rs = $db->CacheExecute('select * from 4images_categories');
if (isset($cache)) $rs = $db->CacheExecute(3600,'select * from 4images_sessions');
 else $rs = $db->CacheExecute('select * from 4images_sessions');
if (isset($cache)) $rs = $db->CacheExecute(7200,'select * from 4images_comments');
else $rs = $db->CacheExecute('select * from 4images_comments');
if (isset($cache)) $rs = $db->CacheExecute(14400,'select * from 4images_sessionvars');
 else $rs = $db->CacheExecute('select * from 4images_sessionvars');
if (isset($cache)) $rs = $db->CacheExecute(14400,'select * from 4images_users');
 else $rs = $db->CacheExecute('select * from 4images_users');

while (!$rs->EOF) {
$rs->MoveNext();
}


This is my insert in index.php of 4images.
All cached are saved in \\temp dir ( windows machine ) /tmp dir ( *nix )



Mike
Title: Gallery VERY slow: Problem? Lots of users/images?
Post by: rohanrohanrohan on June 07, 2003, 07:35:59 PM
yeah mine is exactly same!

but problem is with safe mode my host uses.

the cache directory is also read/write chmod to 777
Title: Gallery VERY slow: Problem? Lots of users/images?
Post by: rohanrohanrohan on June 07, 2003, 08:11:02 PM
OK i think i solved it!! i just deleted the cache folders and created them again and chmod to 777.

same as the gallery solution for safe mode

i see files in each folder. gallery does seem faster.
Title: Gallery VERY slow: Problem? Lots of users/images?
Post by: rohanrohanrohan on June 09, 2003, 06:46:22 PM
ok gallery seems faster slightly. any other suggestions guys!

im aiming to make this thread a kind of reference for all users of 4images to speed up their gallery.

so come on guys plz respond on how to make gallery run faster
Title: Slow
Post by: cisiodon on June 09, 2003, 06:52:17 PM
Make another indexes of tables into MYSQL database..

Mike
Title: Gallery VERY slow: Problem? Lots of users/images?
Post by: rohanrohanrohan on June 09, 2003, 11:00:23 PM
oops sorry csidon. how can i do that in brief.
Title: Slow
Post by: cisiodon on June 09, 2003, 11:41:05 PM
U can use PHPMyadmin and go to DataBase and select the tables and fields you can index:

Example

4-_images_users -> user_id -> name

Then : name of index: name_id

That´s all !!

Mike
Title: Gallery VERY slow: Problem? Lots of users/images?
Post by: rohanrohanrohan on June 10, 2003, 12:09:35 AM
ok on my phpwebadmin i have list of all the fields in the tables. there is an option in each field, to index.

i clicked on one and it simpy said "field indexed"

is this the only thing i do?
Title: Slow
Post by: cisiodon on June 10, 2003, 01:10:48 AM
YOu select another fields that is not indexed......of course, important field that you think is good and can improve the performance.

Mike
Title: Slow
Post by: cisiodon on June 10, 2003, 01:17:43 AM
Make sure !!

In database you have:

Database -> Tables -> Fields....

Example:

   
PHP: MySql Table Manager
 
Create new Table    

 
Total number of records 29, displayed on 2 pages.
This Page | >> 2 |   cat_id cat_name cat_description cat_parent_id cat_hits cat_order auth_viewcat auth_viewimage auth_download auth_upload auth_directupload auth_vote auth_sendpostcard auth_readcomment auth_postcomment


This is an example of 4images_categories..


You can n index : auth_vote....

Mike

Mike
Title: Gallery VERY slow: Problem? Lots of users/images?
Post by: rohanrohanrohan on June 17, 2003, 02:09:29 PM
guys any other suggestions to improve gallery speed? plz wanna make the this ultimate thread on improving gallery speed so everyone can use as a reference
Title: Gallery VERY slow: Problem? Lots of users/images?
Post by: V@no on June 17, 2003, 02:31:50 PM
just one more thing I just found out, if u have "big" templates it will slow down script to...I just tryed use default template on my site and it was about 3-4 times faster then with my template... :(
Title: Re: Gallery VERY slow: Problem? Lots of users/images?
Post by: relu on July 12, 2009, 05:06:41 PM
Is adodb.inc.php  usefull? I don't see any diference...i have much server load.. Really need some changes to improve server load... The new released version have some improvements?