I think that Google developed
BigTable<http://en.wikipedia.org/wiki/BigTable> to
solve this; hadoop's HBase, or any of the myriad other distributed/document
databases should work depending on need:
http://www.metabrew.com/article/anti-rdbms-a-list-of-distributed-key-value-stores/
  http://www.mail-archive.com/[email protected]/msg07011.html

Heretrix <http://en.wikipedia.org/wiki/Heritrix>,
Nutch<http://en.wikipedia.org/wiki/Nutch>,
others use the ARC file format
  http://www.archive.org/web/researcher/ArcFileFormat.php
  http://www.digitalpreservation.gov/formats/fdd/fdd000236.shtml
These of course are industrial strength tools (and many of their authors are
here in the room with us :) The only question with those tools is whether
their might exceeds your needs.

There's some oddball project out there that does peer-to-peer something
something scraping but I can't find it anywhere in my bookmarks. I don't
recall whether they're file-backed or DB-backed.

If you, like us, want something more modest and targeted there is the
recently-released python-toolkit
  http://lucasmanual.com/mywiki/DataHub
I haven't looked at it to see if they've used it at scale.

We infochimps are working right now to clean up and organize for initial
release our own Infinite Monkeywrench, a homely but effective toolkit for
gathering and munging datasets.  (Those stupid little one-off scripts you
write and throw away? A Ruby toolkit to make them slightly less annoying.)
We frequently use it for directed scraping of APIs and websites.  If you're
willing to deal with pre-release code that's never strayed far from the
machines of the guys what wrote it I can point you to what we have.

I think I was probably too tough on bundling into files. If things are
immutable, and only treated in bulk, and are easily and reversibly
serialized, bundling many documents into a file is probably good. As I said,
our toolkit uses flat text files, with the advantages of simplicity and the
downside of ad hoc-ness. Storing into the ARC format lets you use the tools
in the Big Scraper ecosystem, but obvs. you'd need to convert out to use
with other things, possibly returning you to this same question.

If you need to grab arbitrary subsets of the data, and the one set of
locality tradeoffs is better than the other set of locality tradeoffs, or
you need better metadata management than bundled-into-file gives you then I
think that's why those distributed/document-type databases got invented.

flip

On Sat, Jan 24, 2009 at 7:21 PM, Mark Kerzner <[email protected]> wrote:

> Philip,
>
> it seems like you went through the same problems as I did, and confirmed my
> feeling that this is not a trivial problem. My first idea was to balance
> the
> directory tree somehow and to store the remaining metadata elsewhere, but
> as
> you say, it has limitations. I could use some solution like your specific
> one, but I am only surprised that this problem does not have a well-known
> solution, or solutions. Again, how does Google or Yahoo store the files
> that
> they have crawled? MapReduce paper says that they store them all first,
> that
> is a few billion pages. How do they do it?
>
> Raghu,
>
> if I write all files only one, is the cost the same in one directory or do
> I
> need to find the optimal directory size and when full start another
> "bucket?"
>
> Thank you,
> Mark
>
> On Fri, Jan 23, 2009 at 11:01 PM, Philip (flip) Kromer
> <[email protected]>wrote:
>
> > I ran in this problem, hard, and I can vouch that this is not a
> > windows-only
> > problem. ReiserFS, ext3 and OSX's HFS+ become cripplingly slow with more
> > than a few hundred thousand files in the same directory. (The operation
> to
> > correct this mistake took a week to run.)  That is one of several hard
> > lessons I learned about "don't write your scraper to replicate the path
> > structure of each document as a file on disk."
> >
> > Cascading the directory structure works, but sucks in various other ways,
> > and itself stops scaling after a while.  What I eventually realized is
> that
> > I was using the filesystem as a particularly wrongheaded document
> database,
> > and that the metadata delivery of a filesystem just doesn't work for
> this.
> >
> > Since in our application the files are text and are immutable, our adhoc
> > solution is to encode and serialize each file with all its metadata, one
> > per
> > line, into a flat file.
> >
> > A distributed database is probably the correct answer, but this is
> working
> > quite well for now and even has some advantages. (No-cost replication
> from
> > work to home or offline by rsync or thumb drive, for example.)
> >
> > flip
> >
> > On Fri, Jan 23, 2009 at 5:49 PM, Raghu Angadi <[email protected]>
> > wrote:
> >
> > > Mark Kerzner wrote:
> > >
> > >> But it would seem then that making a balanced directory tree would not
> > >> help
> > >> either - because there would be another binary search, correct? I
> > assume,
> > >> either way it would be as fast as can be :)
> > >>
> > >
> > > But the cost of memory copies would be much less with a tree (when you
> > add
> > > and delete files).
> > >
> > > Raghu.
> > >
> > >
> > >
> > >>
> > >> On Fri, Jan 23, 2009 at 5:08 PM, Raghu Angadi <[email protected]>
> > >> wrote:
> > >>
> > >>  If you are adding and deleting files in the directory, you might
> notice
> > >>> CPU
> > >>> penalty (for many loads, higher CPU on NN is not an issue). This is
> > >>> mainly
> > >>> because HDFS does a binary search on files in a directory each time
> it
> > >>> inserts a new file.
> > >>>
> > >>> If the directory is relatively idle, then there is no penalty.
> > >>>
> > >>> Raghu.
> > >>>
> > >>>
> > >>> Mark Kerzner wrote:
> > >>>
> > >>>  Hi,
> > >>>>
> > >>>> there is a performance penalty in Windows (pardon the expression) if
> > you
> > >>>> put
> > >>>> too many files in the same directory. The OS becomes very slow,
> stops
> > >>>> seeing
> > >>>> them, and lies about their status to my Java requests. I do not know
> > if
> > >>>> this
> > >>>> is also a problem in Linux, but in HDFS - do I need to balance a
> > >>>> directory
> > >>>> tree if I want to store millions of files, or can I put them all in
> > the
> > >>>> same
> > >>>> directory?
> > >>>>
> > >>>> Thank you,
> > >>>> Mark
> > >>>>
> > >>>>
> > >>>>
> > >>
> > >
> >
> >
> > --
> > http://www.infochimps.org
> > Connected Open Free Data
> >
>



-- 
http://www.infochimps.org
Connected Open Free Data

Reply via email to