I wonder why you have 3 million files.

Do you really need each of those chunks of data to have a name accessible to all other applications, and the metadata of last access, modified, and inode-changed, and permissions and ownership maintained by the operating system?

Or perhaps, what you should do instead is create a database that stores only the metadata you need for each item, along with the item itself.

PostgreSQL's "binary" columns should handle any data that you might stick into a file, and will scale and replicate nicely. And with a unique index on the data column, you won't even need to "MD5" the data to ensure only one version... just try to insert it, and if it fails, it's already there. Nice atomic test.


In reply to Re: (OT) should i limit number of files in a directory by merlyn
in thread (OT) should i limit number of files in a directory by leocharre

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.