First of all i really want to say thank you ncy and rapsli for your great work.
I'm following this module since its early stages and with 2.x i tried it the first time on my site. It fails because of the "I don't show you empty subfolders"-Bug, so i waited until the 3.x release and guess what : my host doesn't allow temp. tables. After some emails with them they temp. enabled me to create temp. tables and so i started to play a bit around with the current 3.x version of fast gallery. But back to topic :)
First my setup here.
I'm currently on a shared host with 36mb max. ram for php applications, a 5.x mysql(i) database and drupal 6.6. Current MaxExecutionTime is 180s, but i can change that because i have access to the php.ini. The host has a very well performance on the cpu and on the sql side. So lets say its a quality host who knows what he is doing.
My gallery consists of around 10000 pictures in scale of 3-10kb and with a subfolderstructure which is max. 7 Levels deep.
Some words to me : i'm earning my money with developing in delphi for over 8 years now. I never worked with php but i can "read" it. I've worked a lot with databases in delphi but my code knowledge of drupal ... i've look into the code some time ago, but never coded anything for it.
So if some of the things i say here make no sense, aren't possible in drupal or are some how required to be done this way : feel free to blame me ;)
A last comment before i finally get started : None of the things here are meant personally. I'm not here to flame, but to aid you making fast gallery the best gallery for drupal :)
1.) The temporary tables
For me the biggest step from drupal 5.x to the 6.x series was that they got rid of the need for temp. tables in the search. So i was kind of confused, that fastgallery requires them. I took a deeper look into the code of fastgallery and if i understand it right every time you view a page in the gallery, there are 3 temp. querys on the database?
- 1.) You should follow the 6.x way and do not use temp. queries anyway. Your gallery is aiming for "the small guy who just wants to put up some photos on his page". Seems like the permission for temp tables is standard on most hosts, because no one claimed an issue here before. But on the path to make drupal more user friendly and available to all people temp. tables should be avoided,
- 2.) There is absolutly no need for temp. queries. All the sorting you are doing with it could be done with a normal query and then sorting and modifing an array which contains the results. RAM has never been cheeper, but most hosts care if you get there CPUs under 100% load, because of complex temp. queries.
- 3.) Even if you only could do it with temp. queries. Dudes ... you know that three! heavy queries per page will no scale very good. I doubt you're site will run well when around 50-100 people are browsing your gallery.
This is the reason why i put the request on critical. You should really don't use temp. queries.
2.) The database layout
Why are you storing the parent and the folder as fullstrings in the database? You should use a integer there and list the folders in a seperate table. This reduces the size of the queries ( size of the result ). And it saves a lot space in the database.
3.) The EXIF data
You should move the exif thing to a sepeate module ( which can of cause be shipped with fast gallery ). I for example will never use the exif data on my gallery. This again will save around 100000 useless ( 1,5 mb ) entries in a table i will never use. And it will reduce the time / memory load / cpu usage of the cron while reindexing the gallery.
4.) Some smaller things
- 1.) The created url aliases are in upper and lower case depending on the folders name. This should only be lower case, because drupal normally creates lowercase aliases.
- 2.) ( I'm not sure if this is releated to my poorly coded theme :> ) The breadcrums for the gallery are under the normal breadcrums. For me it looks like
Home Gallery > Test > Testing > Test aroundShouldn't this be in one line?
Appendix
I'm sure i missed one point but i think is is enoth for tonight :)
You should take a look at http://picy.infinitesimal.org/
It has the same concept as fast gallery ( folder based gallery ) but it uses NO datebase at all. And it supports sorting to. Maybe it helps reducing fast gallerys dependency on a fast database.
Looking forward to your comments
Mario
Comments
Comment #1
rapsli commentedHi
thanks for your comments. It's always good when experienced developpers take the initiative. When I first started fast gallery I didn't expect the response to be that big. Well my comments:
1) Temp Queries. If you have a patch to fix this issue I'm more than welcome to put this in.
2) Good point.
3) As first "cheap" step an option that enables/disables the exif option would do the job.
4) No. Breadcrumbs are correct like this.
Looking at these issues: Let's make the 3.3 version of Fast gallery about performance and scalability.
Comment #2
XiaN Vizjereij commentedThen i think you should display the crums in one line.
Like i said before : i can not code in php. I ever wanted to learn the syntax, but my project queue is full and will remain full until summer next year.
So i can only assist from outside and not fix or write anything myself. I'm sorry :(
Comment #3
ncy commentedhi, great feedback XiaN!
1) i'm the culprit for temp queries >_<. i did it partly because i couldn't find a working SQL query that encompassed everything that needed to be returned. i only got it working by doing a partial query first and then finishing with the 2nd part of the query on the resulting table. of course, i don't like the fact that there are so many queries. but i kinda threw this part together in a last-frustration attempt because i ran out of time and haven't gotten back to it since. :( if there are any SQL experts out there, feel free to chime in on how to improve (fast_gallery.class.php).
2) agreed. this might help with fixing #1 too. redoing the database would definitely involve some major code overhaul though.
3) yea, i kinda agree too, that requiring all that EXIF data is a bit redundant and unneeded in some cases. maybe restructuring the database and the way image captions/etc are stored might help. again, related to #1 and #2, database changes. separating EXIF into a separate module is an interesting idea. i wonder if that adds more overhaul tho in terms of loading more modules?
4) the breadcrumbs no longer use the $breadcrumb variable. i [arbitrarily] decided that the gallery navigation should be separate from the Drupal $breadcrumb variable, so it can be used for other things.
i havent had much free time as of late ... we need to recruit more programmers to get 3.3 rolling! >_<
-nick
Comment #4
jan.n commentedTopic & Version 3.2 => 4 because this is quite important on shared hosts.
I agree with #1 because I just ran into the problem that on my test-account I don't have CREATE TEMPORARY TABLE permissions.
Furthermore, the OP points out that those temporary queries have quite an impact on the DB and overall performance...
I'd be glad to help, but do not have the required SQL skills :-/
Regards
jan