News for hackers. Stuff that matters.
Re:Show HN: JSONlite – A simple, serverless, zero-configurat... by tyingq on Sunday February 12, 2017 @10:46AM (#13628844)
On 4, the point might be that thousands of files in a single directory can create performance issues with readdir().

The usual workaround to that is to create subdirectories based on the first few characters of the filename.

Since you're using bash, you could do something like:

  $ echo 1df8be33-4392-471a-99af-3df967b87cb6 |sed -e 's/^\(.\)\(.\)/\1\/\2\/\1\2/'
  1/d/1df8be33-4392-471a-99af-3df967b87cb6
Edit: You may want more than 2 levels of directories, or directories with 2 character names instead of 1, etc. Apache's mod_cache defaults to 2 levels of 2 character names, but the filenames are base 64, so more possibilities than hex.

There are no comments on this comment yet.