Reading Server Directories v/s XML File for photo album pages



To load a list of portfolio items (like photo albums), is it appropriate to read server directory every time page loads? Or an accompanying XML/JSON file should be created?


Current solution uses simple directory structure like following:



portfolio/CategoryA
portfolio/CategoryB
portfolio/CategoryA/1.Title.Subtitle
portfolio/CategoryA/5.Title.Subtitle
portfolio/CategoryA/6.Title.Subtitle
portfolio/CategoryB/2.Title.Subtitle
portfolio/CategoryB/3.Title.Subtitle
portfolio/CategoryB/4.Title.Subtitle


Each of the above directories contains image files, which are again directory-read to generate HTML.


Directory names are dot-separated; having sort-order, title and subtitle for each page.


Now we are implementing Previous/Next links in each page, which means that whole server directory structure will have to be read not only to generate a list of albums, but also for each inside page. What are the performance implications of this approach?


If relevant, this is hosted on a shared Linux server.


Instead, an XML/JSON file can be kept with a sorted list of all directories. The question is which one is the correct, optimal approach?


No comments:

Post a Comment