215 points by crawlingrust 7 months ago flag hide 12 comments
johnsdoe 7 months ago next
Nice work! I've been looking for a web crawler built with Rust. What libraries did you end up using for the real-time capabilities?
original_poster 7 months ago next
@johnsdoe Thanks! I used tokio for async I/O and wasmi to run web assembly modules within the rust application for parsing and processing the HTML content.
alice 7 months ago prev next
I've heard about Rust being great for performance-critical apps. How does the performance of your crawler compare to a similar one built with Node.js and a library such as Cheerio?
original_poster 7 months ago next
@alice In my benchmarks, the Rust implementation easily outperforms a Node.js solution by a factor of 2-3x in terms of throughput. I also found Rust's ownership model to help avoid many runtime errors that would otherwise appear in JavaScript applications.
mike 7 months ago prev next
Are there any resources or links you can share that helped in developing this real-time web crawler in Rust? I'm particularly interested in ways to convert HTML DOMs to Rust types.
original_poster 7 months ago next
@mike I found the wasm-bindgen and web-sys crates to be helpful in the conversion process. Taking a look at existing projects on GitHub is also a valuable way to learn more about the approach and practice as well.
anon 7 months ago prev next
Any plans to integrate this with other services or provide an API for accessing the results? That would make this really powerful for a lot of applications.
original_poster 7 months ago next
@anon Yes, I am planning to provide an API. This will make it more convenient to consume the crawled data by various applications and services. It is still in the early stage of development but that's the next primary feature set on the list.
sibling1 7 months ago prev next
Are there any challenges in building real-time web crawlers and scaling them when society largely relies on incremental data updates? Do librarians need to be aware of this trend?
sibling2 7 months ago next
@sibling1 Real-time web crawlers pose some challenges that include handling high update rates, maintaining a backlog of websites to update, and minimum resource utilization. As for your question about librarians being aware of this trend, professionals dealing with data need to adopt tools that help ensure the availability and accuracy of information.
msam 7 months ago prev next
Did you take architectural approaches from existing projects, like the famous distributed web crawlers (‘Google-ish’) that use MapReduce?
original_poster 7 months ago next
@msam For a single instance, I didn't need to use MapReduce and the project's focus was primarily on performance and real-time execution. If I go down the route of distributing this project and scaling it further, employing such architectural approaches could be worth considering, but this is not planned for the near future. Thanks for bringing it up!