FetchItemQueues removes empty queues, which skips the politeness delay

Đang mở
#2,303 2 bình luận 0 reaction 2 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

@GGraziadei đang làm issue này rồi.

Từ ngày 6/11/2026.

  • #2306 của @dpol1 — đang mở

Đánh giá

Issue này chưa được đánh giá.

Mô tả

bug

FetchItemQueues.finishFetchItem removes a queue as soon as its last URL is done. The next URL for that host gets a new queue, which is ready straight away. If that URL arrives after the queue has emptied, for instance an outlink of the host's last page, it can be fetched at once, ignoring fetcher.server.delay and the Crawl-delay from the robots.txt.

This test fails in FetchItemQueuesTest, as a.net/2 is handed out at once:

FetchItemQueues q = queues("fetcher.server.delay", 5.0f);
add(q, "http://a.net/1");
q.finishFetchItem(q.getFetchItem(), false); // the queue of a.net is removed
add(q, "http://a.net/2");
Assertions.assertNull(q.getFetchItem());

In a local crawl with fetcher.server.delay: 3, I got two requests to the same host 11 ms apart. In 12-minute crawls of GQ32K hosts with the default delay of 1 s, a fetch started less than 1 s after the previous one to the same host had ended in 107 of 18,315 cases with OpenSearch, and in 5,422 of 14,151 with URLFrontier, across 799 hosts. The usual gap is just over 1 s. The higher figure is probably because URLFrontier hands out a host's next URLs sooner than the OpenSearch spout, so they more often arrive while the delay is still running. These figures come from the worker logs. I haven't traced them to this code path, and a shorter Crawl-delay could explain some of them.

3.7.0 has the same gap, though not in every case. Its empty queues stay until a getFetchItem scan reaches them, and the threads scan after each fetch and every 100 ms when idle, so a URL arriving before the scan still waits. Since #2132 finishFetchItem removes the queue itself, so the new queue is immediately eligible. I ran the 3.7.0 case only on its queue code.

NUTCH-2947 fixed the same problem in Nutch 1.19 by keeping the state of empty queues. I suggest keeping the time of a host's last fetch until its delay has passed. I can open a PR with the test and a fix, for 4.0 or later.

cc @GGraziadei, since #2132 expected the per-host rate to stay bounded by the crawl delay.

Ngôn ngữ chính
Java
Star
1k
Fork
297
Merge trung bình
1 ngày 11 giờ
Pull request đã merge (30 ngày)
61

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của apache/stormcrawler

Tất cả issue của apache/stormcrawler

Issue tương tự

Thêm issue về Java

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.