Skip to content

armgit / nutch

Public Imported from GitHub
0

Apache Nutch is an extensible and scalable web crawler

NUTCH-1141 Configurable Fetcher queue depth

Julien Nioche55f184554a16
diff --git a/CHANGES.txt b/CHANGES.txt
index b4655f34d..985d43ad7 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -2,6 +2,8 @@ Nutch Change Log
Release 1.4 - Current development
+* NUTCH-1141 Configurable Fetcher queue depth (jnioche)
+
* NUTCH-1091 Remove commons logging dependency from Nutch branch and trunk (lewismc)
* NUTCH-672 allow unit tests to be run from bin/nutch (Todd Lipton via lewismc)
diff --git a/conf/nutch-default.xml b/conf/nutch-default.xml
index cf451f4e6..92ec0b75e 100644
--- a/conf/nutch-default.xml
+++ b/conf/nutch-default.xml
@@ -722,6 +722,16 @@
</description>
</property>
+<property>
+ <name>fetcher.queue.depth.multiplier</name>
+ <value>50</value>
+ <description>(EXPERT)The fetcher buffers the incoming URLs into queues based on the [host|domain|IP]
+ (see param fetcher.queue.mode). The depth of the queue is the number of threads times the value of this parameter.
+ A large value requires more memory but can improve the performance of the fetch when the order of the URLS in the fetch list
+ is not optimal.
+ </description>
+</property>
+
<!-- moreindexingfilter plugin properties -->
<property>
diff --git a/src/java/org/apache/nutch/fetcher/Fetcher.java b/src/java/org/apache/nutch/fetcher/Fetcher.java
index b1b960f89..4c8a78377 100644
--- a/src/java/org/apache/nutch/fetcher/Fetcher.java
+++ b/src/java/org/apache/nutch/fetcher/Fetcher.java
@@ -1057,7 +1057,9 @@ public class Fetcher extends Configured implements Tool,
int timeoutDivisor = getConf().getInt("fetcher.threads.timeout.divisor", 2);
if (LOG.isInfoEnabled()) { LOG.info("Fetcher: time-out divisor: " + timeoutDivisor); }
- feeder = new QueueFeeder(input, fetchQueues, threadCount * 50);
+ int queueDepthMuliplier = getConf().getInt("fetcher.queue.depth.multiplier", 50);
+
+ feeder = new QueueFeeder(input, fetchQueues, threadCount * queueDepthMuliplier);
//feeder.setPriority((Thread.MAX_PRIORITY + Thread.NORM_PRIORITY) / 2);
// the value of the time limit is either -1 or the time where it should finish