用于网络爬虫的python asyncore或threadpool?

时间:2010-09-09 01:11:10

标签: python web-crawler

看起来我可以通过两种方式使用python进行快速爬虫:

  1. 带有套接字的线程池

  2. 非块套接字选择,asyncore等。

  3. 我认为这里的线程没有真正需要,而解决方案#2更好。

    哪个更好,为什么?

1 个答案:

答案 0 :(得分:3)

Twisted通常比asyncore更受欢迎。它是can also work with thread pools

的异步I / O框架

在Python中,您应该首选异步IO到线程,因为GIL会导致threads are a second class citizen in its canonical implementation (CPython)