poor performance G2/storing resized images

thevagabond

Joined: 2005-02-08
Posts: 5
Posted: Tue, 2005-02-08 09:58

Hello there,

at first, sorry for my bad english, i'll try my best :)

I have a performance problem in G2 when i use several image sizes
for my visitors. I server/ wan't to server 640x480/800x600/1024x768/
1280x960 and fullsize (2560x1920). The problem is that each image
is converted only when somebody clicks on it. This takes very long
on my P3/800Mhz SMP, also because only 1 convert at one time is
running (2nd CPU idles). I want to store the resized images for all the
time (not only in cache), so maximum performance could be guaranteed
and no conversion at looking a image is needed (like in g1.4, every image
is resized at the first upload for one resolution, i like it for all resolutions
i configure in the preferences of the album). Is this possible that a) all
the images are converted in the configured resolutions of the album and
b) store it there forever, so no reconversion is ever needed? HDD-space
is not my problem as you can seen :) Thanks a very lot, i'm a really fan
of G2, but without that feature i'm unable to use it because it's really slow
with multiple resolutions :(

Greetings,

thevagabond

----

Gallery URL (optional):
Gallery version: G2-Nightly-Snapshot 20050205
Webserver (with version): apache 1.3
Datatabase (with version): Mysql 3.23.49
PHP version (eg 4.2.1): 4.1.2
phpinfo URL (optional):
Graphics Toolkit(s): Netpbm, Imagemagick
Operating system: Debian GNU/Linux 'woody'
Web browser/version: Mozilla Firefox 0.9.3

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Tue, 2005-02-08 10:35

Once G2 has generated a resized version / a thumbnail of an item, it is stored on the harddisk in the g2data directory. G2 doesn't generate these resized versions on the fly. But if a resized version didn't exist before, it will be generated on the fly when it is first requested.

You can generate all resized versions / thumbnails for an album with one click.
Go to "edit album"->"Album" and select Recreate thumbnails and resizes
[x] Recreate thumbnails
[x] Recreate resized images

And during upload of items, you can check the box "create thumbnail". Not sure about resized versions. But you can always use the edit album->Album->Recreate thumbnails/resizes method.

For better performance:
- use a php accelerator (PHPA, turk mmcache,...)
- use a faster cpu, 800MHz isn't that much
- 512/1024mb are always a good thing for servers (keep db and php cache in ram)
- use apache 2 -> multi threading (you use SMP)
- use php5 once it is stable enough :/
- perhaps there are some notes about performance in the FAQ sticky topic in the G2 forum

 
thevagabond

Joined: 2005-02-08
Posts: 5
Posted: Tue, 2005-02-08 10:47

yeah i thought that too, but if i click to "recreate thumbnails and recreate resized images" i't doesnt convert anything (i'll couldn't see any convert-process). But when i click on a image, i'll see this convert-processes for the configured resoultions in a album (i configure the resolutions in the album properties globally, is this correct or is there a better way). And i don't want to klick every single image to preconvert it (i often upload up to 80 images, and at every click i have to wait a feeew seconds).

I dont't want to solve the problem with CPU-Power, i want to store the different versions there as long as the item changes (and then it should be regenerated)....

i'll think my conversion-cache is propably defect?

 
thevagabond

Joined: 2005-02-08
Posts: 5
Posted: Tue, 2005-02-08 10:50

http://www.tonkrieg.de/gallery2/

you can look at the gallery there, the first image i clicked comes up (relativly) fast,
some others (at the end, etc.) takes up a few seconds, and i really clicked recreate esized images.

Thanks a lot,

thevagabond

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Tue, 2005-02-08 10:55

I had the impression that it works on my machine. Maybe I have too few items but I don't see a "convert-processe", I just have to wait a moment when I recreate thumbs&resizes.

Could you doublecheck that this doesn't work?

Maybe the developer who wrote this code knows more, that will take a couple of hours 'til he sees this topic (USA).

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Tue, 2005-02-08 11:00

after looking at your test album...

IMO this is normal, sorry. G2 serves each thumbnail/image separately.
Install a php accelerator (easy, free) and take a look at my other notes @ performance.

 
thevagabond

Joined: 2005-02-08
Posts: 5
Posted: Tue, 2005-02-08 11:11

I checked that again, if i click an image that has been never clicked, the following process appears:

/usr/bin/convert -quality 100 -size 640x640 -geometry 640x640 /var/www/tonkrieg.de/g2data/albums/testalb/CIMG0287.JPG /var/www/tonkrieg.de/g2data/tmp/imgk_NIdbtX

and that for every resolution (i configured 4, so this takes really long for every image)

If i click "recreate thumbnails and resized images" no convert-process comes up.
Could it be that this option is for single resized images (edit photo, etc.) are only rebuild, not all the photos as defined in the album properties? But it couldn't be that easy, when i edit a single foto, the "Resized Photos"-Checkboxes are all checked with the correct resolution in the fields....

And the Cache-Dir seems pretty small for those much resolutions.... i think there is propably the problem?

 
mindless
mindless's picture

Joined: 2004-01-04
Posts: 8601
Posted: Tue, 2005-02-08 18:47

you can try the BuildAllDerivatives script from here

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Tue, 2005-02-08 20:29

mindless, but why doesn't the "Recreate resizes&thumbs" with "apply to sub-albums box" checked not do the same as BuildAllDerivatives ?

 
mindless
mindless's picture

Joined: 2004-01-04
Posts: 8601
Posted: Tue, 2005-02-08 21:05

those checkboxes recreate the GalleryDerivative items in the db to make sure they have the size settings matching the album preference.. they don't actually go build the derivative files. we could add a checkbox to do that, i suppose.

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Tue, 2005-02-08 23:56

that would be a nice feature. and a note that "recreate" just redefines the properties in the db would be nice too.