title: Efficient way of storing many thumbnails
body: <p>So currently I am storing all thumbnails in a single directory with file name as the md5 hash of the full path to the full size image. But I've read here that this causes issues when directory reaches thousands of files. They will be located slower and slower by the linux file system.</p>
  <p>What alternatives do I have, considering I can only locate the thumbnail by the original image path? Dates would be the best options, like <code>year/month/day/md5_hash.jpg</code>, but that would require me to store and read the date from somewhere, so it would be add some extra steps.</p>
  <p>I was thinking to split the md5, like first two characters = subfolder name, rest = file name. That would give me like 15*15 subfolders, but I'd like to hear better options, thanks!</p>
  <hr />
  <p>Another idea I just got: create a separate server for organizing thumbnails. The server would keep track of thumbnail counts and create additional folders when a certain limit is reached and reuse old folders when thumbs are removed. Downside is that I need a separate db that maps hashes to thumbnail paths :(</p>