Is Gallery2 up to the task?

mikemille

Joined: 2008-10-11
Posts: 3
Posted: Sat, 2008-10-11 22:23

So I've decided to use Gallery2 for a facebook application I'm working on because of it's great features and ease of use. If the application becomes popular, we may end up with a million users with a fairly high load on our servers. Is Gallery2 the right choice for the job? The images are small ... mostly webpage background images. I was wondering if anyone had some performance benchmarks on Gallery2 or any advice to make sure Gallery2 can support a high traffic site.

Thanks! Gallery2 rocks, and hopefully I can continue to use it.

Oh, and I'm planning on using Amazon Elastic Compute Cloud (Amazon EC2) with an Ubuntu instance running apache2. Any experiences with gallery2 and EC2 ???

 
alecmyers

Joined: 2006-08-01
Posts: 4338
Posted: Sat, 2008-10-11 22:50
Quote:
Is Gallery2 the right choice for the job?

I don't think you've given enough information for anyone to be able to start to answer that.

What kind of server? A million registered users? Or a million page impressions? Over what period? Images that get cached because they don't change? Or images uploaded once, downloaded once, and then not viewed again? Large images? Small images? What does "fairly high load" mean? That kind of implies you know the load is only going to be "fairly high" - how do you know that? I don't know of any benchmarks, but there are so many variables that it strikes me that you need to do your own load tests on your intended architecture because nothing anyone else has tried will be relevant.

 
mikemille

Joined: 2008-10-11
Posts: 3
Posted: Sun, 2008-10-12 15:03

The server is an Amazon EC2 Small Instance (1.7 GB of memory, 1 EC2 Compute Unit (1 virtual core with 1 EC2 Compute Unit), 160 GB of instance storage, 32-bit platform). My instance is Ubuntu running apache2. I'm using PHP5 and installed eaccelerator (the accelerator did make a noticeable difference). I've deactivated the ImageBlock plugin as well. I've got about 14000 small images. I'm only serving the thumbnails. User's click on thumbnails to perform an action, so the code won't take them to the larger image behind the thumbnail (custom template). So essentially I'm serving thumbnails.

I'm just trying to figure out how many users I can support with a setup like this. We hope to become the top application on facebook (I know, big dreams). I need to make sure our system can handle that. I can upgrade the server, use other software, or roll my own ... but I'm hoping to use gallery2 (I'm a big fan).

I've done minimal load testing and the results are ok. Maybe you can help me interpret these results from siege:
Lifting the server siege... done.
Transactions: 229 hits
Availability: 100.00 %
Elapsed time: 20.29 secs
Data transferred: 2.52 MB
Response time: 3.15 secs
Transaction rate: 11.29 trans/sec
Throughput: 0.12 MB/sec
Concurrency: 35.53
Successful transactions: 221
Failed transactions: 0
Longest transaction: 20.08
Shortest transaction: 0.15

I ran a siege with 50 users (not for very long):
siege -v --internet --file=pcms_urls.txt --concurrent=50

The urls were a good sample of urls from the gallery.

Here's the gallery that will be embedded in a facebook iframe if you are interested:
http://www.thesuperprofile.com/pcms

Please let me know if you have any advice. Thanks!

 
nivekiam
nivekiam's picture

Joined: 2002-12-10
Posts: 16503
Posted: Sun, 2008-10-12 15:59

If you care more about performance than how many times an item is viewed, I'd suggest disabling view counts. You have to edit a core file for this, meaning you have to make this change every time you upgrade unless you just use the Upgrade Patches and ShowItem.inc doesn't get modified. But those would only work for the security updates within a release 2.2.x for example. For a major release like 2.3 you'd need to overwrite all files.

See this thread on disabling view counts:
http://gallery.menalto.com/node/33037

Also, it appears the code has changed a bit since that thread so you may need to actually delete/comment out a few more lines:
http://fisheye3.atlassian.com/browse/gallery/trunk/gallery2/modules/core/ShowItem.inc?r1=14691&r2=15062

http://fisheye3.atlassian.com/changelog/gallery?cs=15062

I'd also turn the performance settings to "full" under Site Admin > Performance to cache as much as possible.
Here are a few more resources:
http://codex.gallery2.org/Gallery2:Performance_Tips
http://codex.gallery2.org/Gallery2:ACL_Performance

Also, if you are going to have such a public, highly trafficked site, I'd make sure you read through the Security pages:
http://codex.gallery2.org/Gallery2:Security

I don't know about Amazon EC2 and what you can and can't do, but I'd make sure you tighten down permissions as much as you can. On my installs I'm overly paranoid. I have php running as a CGI so that I can run it under my user account. Then I set the permissions on all directories to 501 and files to 404, then I went back through and set all .tpl, .inc, .class to 400 and README.html, MANIFEST and LICENSE to 000. I also set /install, /upgrade and /lib/support to 000.

Only g2data, which isn't publicly accessible, is 700 for directories and 600 for files.

Those permission settings does make it a pain to make modifications as I have to change permissions first, make the change, then change permissions back, but it does prevent any script from being able to write to any directory or change any file through some security hole in either G2 or more likely some other software I'm running. The only way that could happen is if someone either hijacked my account or that security hole somehow allowed them to execute the chmod command to change permissions.

Sorry for the tangents. Depending on the load you may need a bigger server or a server for serving the site and a server for the database or even something clustered. There are some very large Gallery installs with millions of items and tons of users: http://codex.gallery2.org/Gallery2:Scalability

Here's a few more docs:
http://codex.gallery2.org/Gallery2:Design_Documents:ACL_Scalability
http://codex.gallery2.org/Gallery2:Development:Performance_and_Scalability

Don't know the age of those if any info is outdated or not.

I'd probably wait to launch something like this until after 2.3 is released as it caches a bit more info for even more performance.

As for Amazon's EC2 service, search the forums, I believe I read something where someone wrote a doc on how to install Gallery there. Oh wait, maybe that was just their S3 service I'm thinking of: http://gallery.menalto.com/node/77816
____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here

 
mikemille

Joined: 2008-10-11
Posts: 3
Posted: Mon, 2008-10-13 18:49

nivekiam,

Thanks for all the info!

The view counts are important for the app, so I'll have to keep those around.

I set Performance to "full"; thanks for the tip.

As far as waiting for 2.3, I have to go out with the app today. So I'll be going live sometime tonight and gallery2 will be my frontend for now. If I need to, I'll pay for a more powerful instance from Amazon EC2 and put gallery2 on it's own machine (hoping I don't have to do that). The performance seems ok, but we'll see.

I've been meaning to revisit security ... thanks for those tips as well.

Wish me luck. :-)

 
nivekiam
nivekiam's picture

Joined: 2002-12-10
Posts: 16503
Posted: Mon, 2008-10-13 18:57

Good luck. ;) You should be able to upgrade to 2.3 seamlessly when it's released soon.

Let us know how it goes. Once it goes viral and gets big, feel free to update this page: http://codex.gallery2.org/Gallery2:Scalability so we can show people more examples of 1) how gallery is used and 2) more importantly what it can handle.
____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here