March 4, 2008 at 3:56 pm
Hello all,
I am working on moving a PHP based Image search engine over to ASP.net. I have fallen in love the the ease of use of SQL Server and am contemplating something. I have about 700k thumbnails in a ID based directory structures (/00/00/00/1234.jpg, etc). For manageability I would like to move these to a database and then write a asp.net page that would fetch the image and return it as a response to the browser. I know I am adding a layer of complexity that I might regret.
The thing I am most worried about is that each page the user loads has 30 thumbnails on it, so this would generate 30 queries to the database all with seperate connections because they would have to be started from a "seperate page" ie getImage.aspx?id=342345
I am just curious if anyone has tried this and what their experience was with it. I would love to cleanup those directories, but haven't seen other engines use this method (at least not visibly so).
Thanks.
March 5, 2008 at 6:30 am
My thought is the less processing the better. I'd leave the files in the directory structure as is, but only store the path to the image in the DB. then, you can run a query, and dynamically generate as many img tags as you want with the information from the database. If you store the images in the DB, you have to write extra code to get the bits in and out of the table. Let the file system do what it does best: store files.
March 5, 2008 at 7:37 am
We store all images in the db here, the ones in articled, edtiorial, etc. Hasn't been an issue so far.
If they're not too large, it should be ok. The queries will run quickly. The biggest thing is try to get connection pooling going. Not sure how this works with PHP, but it can prevent the time to open and tear down the connection.
March 5, 2008 at 10:14 am
Steve Jones - Editor (3/5/2008)
We store all images in the db here, the ones in articled, edtiorial, etc. Hasn't been an issue so far.If they're not too large, it should be ok. The queries will run quickly. The biggest thing is try to get connection pooling going. Not sure how this works with PHP, but it can prevent the time to open and tear down the connection.
The new site will be in ASP.net so this shouldn't be a big deal. Do you do connection pooling on all your database connections or only those related to the images.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply