在多线程代理中使用

2024-05-12 13:58:03 发布

您现在位置:Python中文网/ 问答频道 /正文

我想用scrapy抓取大约400万个页面。我正在使用storm proxies。 假设我的帐户上允许的线程数是20。 我想问-

多线程意味着每个域并发的请求。在

或者有别的办法。在

我怎样才能有效地使用这20个线程

注意-如果我不清楚我的问题,请留下评论,我会尽量根据这个详细说明。在


Tags: 评论帐户页面线程scrapy我会stormproxies
1条回答
网友
1楼 · 发布于 2024-05-12 13:58:03

直接从文件中:

CONCURRENT_REQUESTS- The maximum number of concurrent (ie. simultaneous) requests that will be performed by the Scrapy downloader.

CONCURRENT_REQUESTS_PER_DOMAIN - The maximum number of concurrent (ie. simultaneous) requests that will be performed to any single domain.

CONCURRENT_REQUESTS_PER_IP - The maximum number of concurrent (ie. simultaneous) requests that will be performed to any single IP. If non-zero, the CONCURRENT_REQUESTS_PER_DOMAIN setting is ignored, and this one is used instead. In other words, concurrency limits will be applied per IP, not per domain.

直接回答你的问题

我怀疑该服务只允许您收集最多20个线程,这意味着它不关心您请求什么,所以您应该使用CONCURRENT_REQUESTS设置为最大20个线程(默认值为16)。在

每个请求都是“某种线程”。它建立在Twisted之上。在你所使用的代理服务看来,没有办法区分两者的区别,所以每个请求都将是一个代理线程!在

相关问题 更多 >