How to structure file server to work with database?
-
I need advise on makeing a good site structure. I have folders that contain unique images uploaded by users that are referenced to database entries. Was told this can cause the server to crash as the number of folders grows. Is there a better solution to this? (it's a windows 2003 server) and mysql server. I believe the DB server is separate from the one hosting the site. Not sure how youtube is structured but it's kinda similiar. there are say 1mln users and so there'd be 1 mln folders on the server each named with the unique user id (as referenced in the users table in DB) so for example tehre are entries Userid 1 2 3 ... And on the server tehre are folders 1 2 3 ... Each folder referencing to the user id. And contains files uploaded by that user. Anyway the questions is that i was told this can cause the server to crash as the number of folders increases. Something about permissions being reset for all the folders once a new one is added. Any opinions? is this a bad structure? how can it be improved? I go with what i can afford atm. So i might switch to a dedicated server but that stil would not solve the problem (if there's any with this) I currently ahve 4000 such folders. Each one has couple of folders inside it and the support staff from the Hosting company said this is causing problems. Please advise.
-
Answer:
I don't believe that server crash is an issue here. NTFS file system can store millions of files in a folder, so you can ignore this. There will however be a performance issuce if your file naming is more than 8 characters long, simply because NTFS by default needs to regenerate a 8.3 filename everytime you create a file. Performance decreases as the number of files increases in a directory. Why are you storing files per user? This is not really necessary. Option 1 is to place all your files in 1 directory, as long as you have a way to guarantee that each file name will be unique. Option 2 is to create a folder per date ("2009-07-30"), then all files uploaded on that day will be stored there. Either way, performance should not be an issue. You should base your choice on flexibility for archiving data and migrating the information to another drive in case you run out of filespace. So, in your code, you could say "all files created after 2010-01-01 will be placed on drive F:". This is pretty simple to code and to implement. Hope this helps! Good luck!
hytga at Yahoo! Answers Visit the source
Related Q & A:
- How To Get File Server Free?Best solution by engadget.com
- How to drop all connections to a specific database in postgres without stopping the server?Best solution by Database Administrators
- How to connect Sql Server Database from android app?Best solution by Stack Overflow
- How convert .txt file to .Dat file in php?Best solution by Stack Overflow
- How to upload file to a server from Salesforce?Best solution by help.salesforce.com
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.