"Edit Captions" Menu Overloads Server

Mr. B

Joined: 2005-10-09
Posts: 25
Posted: Sat, 2010-04-24 07:27

I'll try and keep this short. I have a 2.3.x installation with a couple thousand photos in it. After adding a new folder with 100+ photos in it, I like to go through with the edit captions menu and 9 at a time, fill in titles and descriptions. Apparently, this action which should not have to touch the actual photos is initializing dozens of "convert" processes. I have had a shared hosting account suspended more than once because of this... while merely editing captions.

Here's a recent excerpt of an email I just received from my host

Quote:
This is to alert you that we had to temporarily
suspend the tagclan.com account as it was overloading
the server and causing it to become non-responsive.

The problem this morning is identical to that seen
on Monday April 19th under which multiple resource-
intensive convert processes running under the tagclan
userid were bringing down the server.

4850 tagclan 39 19 109m 36m 32m R 41.7 0.5 0:03.56 convert
4802 tagclan 39 19 107m 34m 30m R 34.3 0.4 0:06.42 convert
4793 tagclan 39 19 107m 34m 30m R 28.3 0.4 0:07.09 convert
4797 tagclan 39 19 107m 34m 30m R 28.3 0.4 0:07.15 convert
4845 tagclan 39 19 107m 34m 30m R 28.3 0.4 0:03.60 convert
4846 tagclan 39 19 107m 34m 30m R 28.3 0.4 0:03.53 convert
4852 tagclan 39 19 109m 36m 32m R 28.3 0.5 0:03.19 convert
4855 tagclan 39 19 109m 36m 32m R 28.3 0.5 0:03.25 convert
4789 tagclan 39 19 107m 34m 30m R 26.8 0.4 0:07.67 convert
4792 tagclan 39 19 109m 36m 32m R 26.8 0.5 0:06.76 convert
4795 tagclan 39 19 107m 34m 30m R 25.3 0.4 0:07.49 convert
4856 tagclan 39 19 109m 36m 32m R 25.3 0.5 0:03.21 convert

We killed several hundreds of these processes over
the last 30 minutes prior to temporarily suspending
service. Service has been resumed, however if the
problem occurs again the account will be disabled.

If anyone knows what might be the culprit here I would be very appreciative of a remedy. This is a frustrating issue because such simple additions to a database shouldn't be locking up a server. It's quite embarrassing to grovel to my host repeatedly.

Gallery URL = http://mrbsdomain.com/gallery2/main.php
Gallery version = 2.3.1 core 1.3.0.1
API = Core 7.54, Module 3.9, Theme 2.6, Embed 1.5
PHP version = 5.2.5 cgi
Webserver = Apache
Database = mysql 5.0.90-community, lock.system=flock
Toolkits = ImageMagick, Exif, Gd
Acceleration = none, none

 
alecmyers

Joined: 2006-08-01
Posts: 4342
Posted: Sat, 2010-04-24 12:34

convert is imagemagick's binary executable which is used by G2 to prepare derivative images - thumnails, resizes etc. Derivative images are cached but obviously have to be created the first time they are viewed, which might well be immediately after adding images when you edit captions (which displays a thumbnail so you can see which image you're editing).

The soubriquet "resource intensive" ("resource intensive convert processes") sounds like a way for your hosting provider to make you feel bad about something that is a totally normal part of G2 operations (using GD is much more resource-intensive) because they're not willing to provide you with a decent hosting service, probably because they're overloading their servers to make more money.

Assuming that these are new images (G2 carefully caches all derivatives so they only need to be built once) you can try making sure that thumbnails are created at upload time (there's a check-box for that, with most upload methods) or you could page through the albums slowly to get the thumbnails created (although to be honest a page at a time is how the edit captions page would work too, I think).

Other than that, your options are:

Don't use G2. G3 is less resource intensive, but it still uses external binaries like ImageMagick's convert for creating thumbnails as that's the least resource-intensive way to do it - so your host might not like that either

Or - use a different host. To be honest, unless you're paying less than $5 per annum, it sounds like your hosting service is a crock, anyway. If you are paying less than $5 p.a. then ... that's the kind of service and resource you'd expect to get for the price.

Quote:
such simple additions to a database shouldn't be locking up a server

Even simple operations with G2 can be complex under-the-hood, the fact that G2 makes it look simple is part of its success - and they aren't locking up the server, your hosting provider is feeding you a load of bull because they won't let you use a reasonable amount of resource for what you're trying to do.

EDIT - having written all that, I've thought of something else. The convert process should die as soon as it's done the image it was executed for, so they shouldn't be long-lived - they shouldn't hang around long enough for anyone to need or be able to terminate them manually. As it's an external process though, there's not much G2 can do about that. If they are long-lived you could try switching to NetPBM to avoid the issue entirely, or ask your host to investigate the ImageMagick install (or do it yourself.)