Apache Nutch is an extensible and scalable web crawler
NUTCH-1238 Fetcher throughput threshold must start before feeder finished
Markus Jelsma901c8e101a7c
diff --git a/conf/nutch-default.xml b/conf/nutch-default.xmlindex 9636d4eec..5cb37a4f7 100644--- a/conf/nutch-default.xml+++ b/conf/nutch-default.xml@@ -722,6 +722,12 @@</description></property>+<property>+ <name>fetcher.throughput.threshold.check.after</name>+ <value>5</value>+ <description>The number of minutes after which the throughput check is enabled.</description>+</property>+<property><name>fetcher.threads.timeout.divisor</name><value>2</value>diff --git a/src/java/org/apache/nutch/fetcher/Fetcher.java b/src/java/org/apache/nutch/fetcher/Fetcher.javaindex 43e1e64ab..0fa8b2f4b 100644--- a/src/java/org/apache/nutch/fetcher/Fetcher.java+++ b/src/java/org/apache/nutch/fetcher/Fetcher.java@@ -1180,6 +1180,7 @@ public class Fetcher extends Configured implements Tool,if (LOG.isInfoEnabled()) { LOG.info("Fetcher: throughput threshold: " + throughputThresholdPages); }int throughputThresholdMaxRetries = getConf().getInt("fetcher.throughput.threshold.retries", 5);if (LOG.isInfoEnabled()) { LOG.info("Fetcher: throughput threshold retries: " + throughputThresholdMaxRetries); }+ long throughputThresholdTimeLimit = getConf().getLong("fetcher.throughput.threshold.check.after", -1);do { // wait for threads to exitpagesLastSec = pages.get();@@ -1204,15 +1205,9 @@ public class Fetcher extends Configured implements Tool,}// if throughput threshold is enabled- if (!feeder.isAlive() && throughputThresholdPages != -1) {- // Have we reached the threshold of pages/second and threshold was not yet exceeded- if (pagesLastSec > throughputThresholdPages && !throughputThresholdExceeded) {- LOG.info("Exceding " + Integer.toString(throughputThresholdPages) + " pages/second");- throughputThresholdExceeded = true;- }-+ if (throughputThresholdTimeLimit < System.currentTimeMillis() && throughputThresholdPages != -1) {// Check if we're dropping below the threshold- if (throughputThresholdExceeded && pagesLastSec < throughputThresholdPages) {+ if (pagesLastSec < throughputThresholdPages) {throughputThresholdNumRetries++;LOG.warn(Integer.toString(throughputThresholdNumRetries) + ": dropping below configured threshold of " + Integer.toString(throughputThresholdPages) + " pages per second");@@ -1274,6 +1269,11 @@ public class Fetcher extends Configured implements Tool,getConf().setLong("fetcher.timelimit", timelimit);}+ // Set the time limit after which the throughput threshold feature is enabled+ timelimit = getConf().getLong("fetcher.throughput.threshold.check.after", 10);+ timelimit = System.currentTimeMillis() + (timelimit * 60 * 1000);+ getConf().setLong("fetcher.throughput.threshold.check.after", timelimit);+int maxOutlinkDepth = getConf().getInt("fetcher.follow.outlinks.depth", -1);if (maxOutlinkDepth > 0) {LOG.info("Fetcher: following outlinks up to depth: " + Integer.toString(maxOutlinkDepth));