News for hackers. Stuff that matters.
Re:How to write a crawler by cmiles74 on Sunday September 29, 2013 @04:21PM (#6466366)
I respectfullly disagree. If ever there was a use-case for a NoSQL storage solution, web crawling certainly seems to be it. I've used Elasticsearch for indexing and Cassandra for storage, performance was more than good enough for our use-cases. It was easy to scale, as well.
Re:How to write a crawler by EmanueleMinotto on Sunday September 29, 2013 @04:40PM (#6466439)
A NoSQL solution is good because it's a DBMS (allows you to order collections). :) Filesystem is not good because you would need to order links' files in visited descendent order (not allowed in much filesystems), and to check if an URL is in the index you must store it with the MD5 as file name. A small DBMS like SQLite is not good for obvious reasons.
Re:How to write a crawler by nostrademons on Sunday September 29, 2013 @06:47PM (#6466855)
I would highly recommend storing the working set of links in RAM (with checkpointing to write it out to disk periodically). A Redis Set (for visited links) + Sorted Set (for unvisited links, ordered by priority) is perfect for this, since it lets you take up one full machine's RAM and does checkpointing automatically. If your crawl is too big to fit in RAM, get more machines and shard by URL hash. As others have pointed out, the file content itself should go in files, ideally ones that you can write to with straight appends.

The reason you don't want to hit the disk with each link (as both MySQL and PostGres usually do, barring caching) is that there can be hundreds to thousands of links on a page. A disk hit takes ~10ms; if you need to run hundreds of those, it's well over a second per page just to figure out which links on it are unvisited. Accessing main memory is about 100,000 times faster; even with sharding and RPC overhead for a distributed memory cache, you end up way ahead.

The reason to write the crawl text to an append-only log file is because disk seek times are bound by the rotation speed of the disk, which hasn't changed much recently, while disk bandwidth is bound by the rotation time of the disk divided by capacity, which has gone way up. So appends are much more efficient on disk than seeks are.

Re:How to write a crawler by gondo on Sunday September 29, 2013 @11:59PM (#6467700)
why do you need Cassandra? isn't it possible to use different storage engines for ES? (disk + memory)
Re:How to write a crawler by cmiles74 on Monday September 30, 2013 @08:18AM (#6469110)
I was storing a lot of raw data (the content of the page crawled, PDF files) and there's no real gain to keeping it inside of the index.
Re:How to write a crawler by gondo on Monday September 30, 2013 @07:43PM (#6473069)
hm im doing similar thing but im storing raw data in S3 and glacier. no need for nosql for this. or am i missing something?