PHP / MySQL efficiency?

LoneShepherd

Joined: 2003-12-29
Posts: 59
Posted: Wed, 2006-03-08 22:54

I have a medium-sized gallery install (~30 albums, ~500 photos or less) that receives moderate to heavy traffic (~300,000 pages a month).

My (webhosting) account for this domain was suspended today for "excessive system resource usage due to large quantities of PHP/MySQL traffic being generated by the domain and creating high server loads".

I queried further, and was told "the domain is generating far too many MySQL queries (>30 per second)".

WTF?? What could cause gallery to behave like this?

Anyone seen similar problems? Are there known issues with system performance and gallery 2.0.2? What exactly does gallery use the MySQL database for?

How do I resolve this issue?


Gallery version = 2.0.2 core 1.0.0.2
PHP version = 4.4.0 cgi
Webserver = Apache
Database = mysql 4.1.14-standard
Toolkits = Exif, ImageMagick, Gd
Operating system = Linux cpanel30.gzo.com 2.6.11.11 #1 SMP Wed Jun 1 16:59:27 CDT 2005 i686
Browser = Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.1) Gecko/20060111 Firefox/1.5.0.1

 
ckdake
ckdake's picture

Joined: 2004-02-18
Posts: 2258
Posted: Tue, 2006-03-14 05:48

Depending on how your hosting provider measures traffic to the db, you may be getting bursts that big when a search engine indexes your site or when there are several visitors active.

All information about everything in Gallery 2 is stored in the database and thats part of how a database driven site works.

With 2.1 you can enable page level caching which will probably lower the number of database hits on a site like yours substantially. If you are using random block or random image highlights, turning those off will help some.

--
http://ckdake.com/

If you found my help useful, please consider donating to Gallery.

 
LoneShepherd

Joined: 2003-12-29
Posts: 59
Posted: Tue, 2006-03-14 07:33

Thanks for the info.

I was using Image Block to display a random image; I have disabled that module. I have also uploaded a robots.txt file to keep the bots away.

Re: Gallery 2.1 and caching -- is this the "Performance" tab? I will try enabling Partial Acceleration and see how that goes.

 
ckdake
ckdake's picture

Joined: 2004-02-18
Posts: 2258
Posted: Tue, 2006-03-14 07:38

Yup. The Performance tab would be the one I was talking about. Good luck!

--
http://ckdake.com/

If you found my help useful, please consider donating to Gallery.

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Tue, 2006-03-14 08:44

without the acceleration stuff in g2, each hit / request will generate about 25-30 db queries. that's a lot and we'll probably bring that down a little in g2.2. but it's like that for now.