siwelis Posted March 1, 2010 Share Posted March 1, 2010 In consideration of performance: Is having a lot of folders ok? Like 500 in one folder? Or would it be best if broken down into multiple folders for performance factors? Like 100-300 folders per folder? Thank you in advance. Quote Link to comment https://forums.phpfreaks.com/topic/193819-having-a-lot-of-folders-is-ok/ Share on other sites More sharing options...
freakstyle Posted March 12, 2010 Share Posted March 12, 2010 It really depends on your operating system and application needs. Having many nested directories can have adverse affects on your servers ability to maintain a speedy indexing service. More important questions: What's your need to have the application set like this? How are you accessing the data contained in those directories? Can you use a database instead, it sounds like your replicating database functionality manually... but then again you didn't really say much about what the overall goal is. good luck Quote Link to comment https://forums.phpfreaks.com/topic/193819-having-a-lot-of-folders-is-ok/#findComment-1025395 Share on other sites More sharing options...
siwelis Posted March 21, 2010 Author Share Posted March 21, 2010 The overall goal is to have images organized. I've made the mistake of being "too organized" before though, and then not being able to find anything! Years ago I heard that it can be harder for a server to find one image in a folder of 100,000 images than finding it in an extra directory which only has 50,000 images in it. However, I don't really know if what "i heard" was true, considering the server would have to spend time finding the extra directory as well. For now, I assume that finding the extra directory would be worth the time if it broke the next significantly larger portion of the search down by 50%. However, if there were only a few files in the following folders, the extra folder depth incurred would be a waste of time. Quote Link to comment https://forums.phpfreaks.com/topic/193819-having-a-lot-of-folders-is-ok/#findComment-1029689 Share on other sites More sharing options...
freakstyle Posted April 1, 2010 Share Posted April 1, 2010 so it's just about saving images. in that case, i'd suggest keeping them organized with a nested directory structure. One that defines the type of images in the folder. lets use a typical set up for images on a website. /images ( no images in this dir, just sub directories ) /images/buttons /images/titles /images/cars /images/cars/blue How far you go into your nesting is a consideration that you must make. It's easy to keep them all categorized in deep nested sets, but if there's only going to be one image in each directory for the next year or five it's not worth it. As for how many you should keep in a directory, again OS is a big factor here... ie using windows will add more overhead. But again, how are you searching for the images? is this just you looking for an image to embed in some html or are you building a script / app that will need access to read and or write images to the filesystem? If it's the later, then look up times can be increased by a single directory with 100k images. A basic reason is most of the time you are going to read the directory files alphanumerically, making requests for 'zanky.jpg' longer then 'apple.jpg' in one directory. you shouldn't notice this difference under normal circumstances, but it is there. Quote Link to comment https://forums.phpfreaks.com/topic/193819-having-a-lot-of-folders-is-ok/#findComment-1035566 Share on other sites More sharing options...
oni-kun Posted April 16, 2010 Share Posted April 16, 2010 Ext3/Reiser will not care hinder under a load of folders, but do not keep them in so many as you're wasting physical resources. Quote Link to comment https://forums.phpfreaks.com/topic/193819-having-a-lot-of-folders-is-ok/#findComment-1042850 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.