random imageblock very slow?!

tigerstripedcat

Joined: 2005-06-20
Posts: 7
Posted: Tue, 2005-06-21 03:13


Gallery version: gallery2 CVS
Webserver (with version): apache 2.0.53
Datatabase (with version): mysql 4.0.23
PHP version (eg 4.2.1): 4.3.10
Graphics Toolkit(s): imagemagick
Operating system: linux ubuntu 5.04
Web browser/version: firefox 1.04
G1 version (for migration bugs): 1.31?

I'm not sure if this is specific to gallery2, but I have a problem with random image blocks taking around 10 seconds to fetch an image. (And since I have 6 in a row, it can hurt load times). If I reference the imageblock with localhost it goes much faster, but not if I use the proper webaddress.

Is a 10 second load time normal for a random imageblock?

works fast this way:

<?php @readfile('http://localhost/gallery/main.php?g2_view=imageblock.External&g2_blocks=randomImage&g2_show=none'); ?>

but not with the website name, here's the access.log:

192.168.1.1 - - [20/Jun/2005:22:38:17 -0400] "
192.168.1.1 - - [20/Jun/2005:22:38:17 -0400] "
....
192.168.1.1 - - [20/Jun/2005:22:39:29 -0400] "GET /gallery/main.php?g2_view=imageblock.External&g2_blocks=randomImage&g2_show=none HTTP/1.0" 200 399 "-" "-"
192.168.1.1 - - [20/Jun/2005:22:39:39 -0400] "GET /gallery/main.php?g2_view=imageblock.External&g2_blocks=randomImage&g2_show=none HTTP/1.0" 200 408 "-" "-"
192.168.1.1 - - [20/Jun/2005:22:39:50 -0400] "GET /gallery/main.php?g2_view=imageblock.External&g2_blocks=randomImage&g2_show=none HTTP/1.0" 200 399 "-" "-"
192.168.1.1 - - [20/Jun/2005:22:40:01 -0400] "GET /gallery/main.php?g2_view=imageblock.External&g2_blocks=randomImage&g2_show=none HTTP/1.0" 200 402 "-" "-"
192.168.1.1 - - [20/Jun/2005:22:40:14 -0400] "GET /gallery/main.php?g2_view=imageblock.External&g2_blocks=randomImage&g2_show=none HTTP/1.0" 200 402 "-" "-"
192.168.1.1 - - [20/Jun/2005:22:40:24 -0400] "GET /gallery/main.php?g2_view=imageblock.External&g2_blocks=randomImage&g2_show=none HTTP/1.0" 200 399 "-" "-"
192.168.1.1 - - [20/Jun/2005:22:39:19 -0400] "GET / HTTP/1.1" 200 17438 "-" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.6) Gecko/20050223 Firefox/1.0.1"
192.168.1.1 - - [20/Jun/2005:22:40:24 -0400] "GET /styles-site.css HTTP/1.1" 304 - "" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.6) Gecko/20050223 Firefox/1.0.1"
192.168.1.1 - - [20/Jun/2005:22:40:24 -0400] "GET /img/contrails.jpg HTTP/1.1" 304 - "" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.6) Gecko/20050223 Firefox/1.0.1"
192.168.1.1 - - [20/Jun/2005:22:40:24 -0400] "GET /gallery/main.php?g2_view=core.DownloadItem&g2_itemId=88&g2_serialNumber=2 HTTP/1.1" 200 4148 "" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.6) Gecko/20050223 Firefox/1.0.1"
192.168.1.1 - - [20/Jun/2005:22:40:24 -0400] "GET /gallery/main.php?g2_view=core.DownloadItem&g2_itemId=4318&g2_serialNumber=2 HTTP/1.1" 200 2675 "" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.6) Gecko/20050223 Firefox/1.0.1"
192.168.1.1 - - [20/Jun/2005:22:40:24 -0400] "GET /gallery/main.php?g2_view=core.DownloadItem&g2_itemId=2362&g2_serialNumber=2 HTTP/1.1" 200 3805 "" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.6) Gecko/20050223 Firefox/1.0.1"
192.168.1.1 - - [20/Jun/2005:22:40:24 -0400] "GET /gallery/main.php?g2_view=core.DownloadItem&g2_itemId=1945&g2_serialNumber=2 HTTP/1.1" 200 2609 "" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.6) Gecko/20050223 Firefox/1.0.1"[/code]

Login or register to post comments
tigerstripedcat

Joined: 2005-06-20
Posts: 7
Posted: Thu, 2005-06-23 04:15

Can anyone help me?

Login or register to post comments
rogermh

Joined: 2005-01-09
Posts: 102
Posted: Thu, 2005-06-23 05:12

I'm pretty sure you're supposed to have a colon between 'imageblock' and 'External' rather than a period.

Compare this:
<?php @readfile('http://localhost/gallery/main.php?g2_view=imageblock:External&g2_blocks=randomImage&g2_show=none'); ?>

with what you have. Does fixing that help?

Also, you may not need the '&g2_show=none'. I don't want to show anything except for the picture so I just left that part out.

Login or register to post comments
tigerstripedcat

Joined: 2005-06-20
Posts: 7
Posted: Thu, 2005-06-23 05:14

I seemed to have fixed it (temporarily?)

I don't know how I did it.
1) Messed with config.php
2) changed localhost->ipaddress->web address (I use no-ip.com for redirection, and I don't know if that has anything to do with it.)

Login or register to post comments
tigerstripedcat

Joined: 2005-06-20
Posts: 7
Posted: Thu, 2005-06-23 05:22

I also edited <?php ... ?> to encapsulate all readfile lines. I could of sworn I did this before and it not work. But maybe this fixed it.

Just incase someone has a similar problem....

Login or register to post comments
valiant

Joined: 2003-01-04
Posts: 32356
Posted: Thu, 2005-06-23 05:45

@imageblock:External vs imageblock.External

if you are using a current version of G2, it's imageblock.External.
imageblock:External was the old format (beta 3 and prior).

Login or register to post comments
coppit

Joined: 2002-09-15
Posts: 33
Posted: Tue, 2005-06-28 15:38

Can you clarify what you mean by "edited <?php ... ?> to encapsulate all readfile lines"?

Also, do you really think that changing localhost->IP made a difference? I can't imagine that it would. In my case, doing so causes the image block to fail because DB permissions are only granted for "localhost". Maybe this is what you were seeing?

Login or register to post comments
nick5000

Joined: 2004-07-29
Posts: 6
Posted: Sun, 2005-07-10 14:11

I'm going to reopen this one, since there was no real solution posted. I've been having the same problem w/ my G2 install (CVS). I have included the image block in my tiki install like this:
<?php @readfile('http://******/gallery/main.php?g2_view=imageblock.External&g2_blocks=randomImage&g2_show=title'); ?>
... and my execution time jumps from 1.6 seconds to 5.8. I just upgraded my gallery from gallery 1 to 2. I had been using the old random image block from gallery 1 (something like random_image.php), and my execution time only took about a half-second hit. I am using Turck MMCache. Please let me know if there are any known solutions to this problem.

Thanks,
Nick
-------------
Gallery version = 2.0-beta-3+ core 0.9.29
PHP version = 4.3.8 cgi-fcgi
Webserver = Microsoft-IIS/5.0
Database = mysql 4.0.20a-debug
Toolkits = Ffmpeg, Gd, ImageMagick, Thumbnail
Operating system = Windows NT **** 5.0 build 2195
Browser = Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.8) Gecko/20050516 Firefox/1.0.4 (ax)

Login or register to post comments
valiant

Joined: 2003-01-04
Posts: 32356
Posted: Sun, 2005-07-10 14:21

nick5000, just measure the execution time of an ordinary G2 showitem request or a g2 http://******/gallery/main.php?g2_view=imageblock.External&g2_blocks=randomImage&g2_show=title for itself without the wiki stuff. this is the time you have to accept.

Login or register to post comments