Nutch of the __nutch of the Hadoop method in the crawl efficiency optimization

Source: Internet
Author: User

Here are some of the potential factors that affect crawl efficiency (official translation):

1) DNS Settings
2 The number of your reptiles, too much or too little
3) Bandwidth Limit
4 The number of threads per host
5 The distribution of URLs to crawl is uneven
6) High Crawl latency in robots.txt (usually occurs at the same time as the distribution of URLs)
7 There are a lot of slow pages (usually with uneven distribution at the same time)
8 to download too much content (PDF, large HTML page, usually and uneven distribution at the same time)
9) Other

So how to improve them now.

1 Setting up DNS on every local reptile machine, if it is a case of multiple crawl machines and a single DNS center, it will slow down the entire system as if it were a Dos attack on a DNS server. We often set the two layer, hit the local DNS cache first, then the large DNS cache, like OpenDNS or Verizon.
2 This will be the number of map tasks multiplied by the value of the Fetcher.threads.fetch attribute. So 10 map Tasks * 20 threads = 200 Crawl lists at a time. Too many words will be more than your system burden, too little will make some machines idle. You need to seriously consider how to set these properties in your environment.
3 Bandwidth limitations, use Ntop,ganglia and other monitoring software to determine how much bandwidth you use. Calculate the input and output bandwidth. You can do a simple test by crawling a server that does not need to be a reptile in the crawl network, if it is connected to one of the reptiles or when the machine is crawling to download information from the very slow, then you can increase the bandwidth. If you set the HTTP timeout as I said later and increase your bandwidth, you'll start to see a lot of HTTP timeout errors.
4 The uneven allocation of URLs is likely to be one of the biggest constraints on performance. If a line one thread is working on a Web site and there are a lot of URLs waiting to crawl, the other threads will sit idle until the thread finishes crawling. Some of the solutions are Use Fetcher.server.delay to shorten the time between crawl of a Web page and use Fetcher.threads.per.host to increase the number of threads that the same site crawls (this is still in the same map task and therefore is handled in subtasks within the same JVM). If you set these properties to be greater than 0, you can also set the Fetcher.server.min.delay property to be greater than the minimum and maximum bounds of the 0来 settings processing.
5 capture a large number of pages on a website or crawl a large number of pages on a small number of sites will significantly reduce the speed of the crawl. For full web crawling, you want to use a distributed environment to make all the crawl threads active. Setting Generate.max.per.host greater than 0 will limit the number of pages crawled on the same site/domain
6) crawl delay. Most sites do not use these settings only a few use (some malicious Web sites). I've seen crawl delays the maximum of 2 days delay per second. The Fetcher.max.crawl.delay property ignores pages that have a crawl delay greater than X. I often set it to 10 seconds and the default is 30 seconds. Although set to 10 seconds, if you have a large number of pages on a site to crawl, but you can only crawl every 10 seconds a page, which is also very slow. On the other hand, set its value too youngster to ignore the page and not crawl the pages.
7 Sometimes, the page is just slow. Setting the value of a http.timeout is helpful in this case. Its default value is 10 seconds. If you don't care and want all pages to be as fast as possible, set it down a little bit. Some websites. Digg, for example, restricts your bandwidth in your Web site and only allows you to have X connections to your machine within a certain time period. So even if you only crawl 50 pages in one website (I still think too much). This will wait 10 seconds on each page. Ftp.timeout can also be used to set the time interval for crawling FTP content.
8 A lot of content means to reduce the speed of the crawl. Especially when downloading PDFs or other non-HTML files. To avoid downloading non-HTML content, you can use a URL filter. I prefer prefix and suffix filters. The Http.content.limit and Ftp.content.limit properties can limit how much data is downloaded in a document.
9 other factors that may result in crawl slowing down:
The maximum number of sockets or files that can be opened by a single machine. You may begin to see an IO error or an error that cannot open the socket. Inefficient routing. Bad or home routing does not control the establishment of a large number of connections at the same time. An incorrect routing setting can also cause problems, but these problems are often difficult to find. If you think this is the problem, you can use the Network tracking and mapping tool to find it. The reverse route may be a problem for your network provider. Bad network card. I have seen some network cards suddenly reach a certain bandwidth value. This problem is more common when using a new NIC. This is usually not the first thing I think of, but it's usually possible. You can use tcpdump and network monitoring

This optimization direction:

a,1) 3 for hardware, the set is good after the change is not big. No consideration.
b,5) Generate.max.per.host is temporarily set to 0. No consideration.
c,8 This reptile settings crawl Web content only, do not crawl media files.
d,2) 4) 6) 7 9) for optimization purposes

Hadoop configuration:

Three: Host memory 8g,2 console slave memory 20G, master and slave memory configuration unreasonable There are some reasons, here will not repeat. The future is also an optimization direction

Network bandwidth: 100M

Pre-optimization preparation work:

When the number of seeds is around 10, the crawl efficiency of the stand-alone and Hadoop versions is approximately 2/sec (including indexing) before the optimization is in place.
Optimizes the Nutch index, stored and indexed, the index does not need to store as far as possible not to store, does not need the index as far as possible not to index. and get rid of unnecessary index items. When the number of seeds is increased to around 40, the Hadoop version is about 3.5/sec crawl efficiency. Therefore, the optimal direction of the seed quantity to the crawling has been determined.

Refer to the optimization guidelines for Hadoop and do the following optimizations:

1, optimize system parameters ReadAhead buffer
Blockdev--report
Blockdev--setra 1024/DEV/SDA
2, Optimizing Hadoop parameters
Hdfs-default
Dfs.namenode.handler.count:20
Dfs.datanode.handler.count:5
Dfs.replication:3
Mapred-default.xml
Mapreduce.tasktracker.http.threads:50
Io.sort.factor:20
mapred.child.java.opts:-xmx400m
mapreduce.task.io.sort.mb:200
mapreduce.map.sort.spill.percent:0.8
Mapreduce.map.output.compress:true
Mapreduce.map.output.compress.codec:org.apache.hadoop.io.compress.DefaultCodec Com.hadoop.compression.lzo.LzoCodec is the best
Mapreduce.reduce.shuffle.parallelcopies:10

optimization Start:

2014/7/9 Morning

Optimize content :

Increase the number of seeds: Select about 3000 of valid foreign websites.

Yarn-site
<property>
<name>yarn.scheduler.minimum-allocation-mb</name>
<value>2048</value>
</property>
<property>
<name>yarn.scheduler.maximum-allocation-mb</name>
<value>3072</value>
</property>
Mapred-site
<property>
<name>mapreduce.map.memory.mb</name>
<value>1536</value>
</property>
<property>
<name>mapreduce.reduce.memory.mb</name>
<value>2560</value>
</property>
<property>
<name>mapreduce.map.java.opts</name>
<value>-Xms512m-Xmx1024m</value>
</property>
<property>
<name>mapreduce.reduce.java.opts</name>
<value>-Xms1024m-Xmx2048m</value>
</property>
Slave
Yarn-site
<property>
<name>yarn.scheduler.minimum-allocation-mb</name>
<value>3072</value>
</property>
<property>
<name>yarn.scheduler.maximum-allocation-mb</name>
<value>6144</value>
</property>
Mapred-site
<property>
<name>mapreduce.map.memory.mb</name>
<value>4096</value>
</property>
<property>
<name>mapreduce.reduce.memory.mb</name>
<value>8192</value>
</property>
<property>
<name>mapreduce.map.java.opts</name>
<value>-Xms2048m-Xmx3072m</value>
</property>
<property>
<name>mapreduce.reduce.java.opts</name>
<value>-Xms5120m-Xmx6144m</value>
</property>

Results:

A total of 91,986 SOLR indexes were crawled and were set to take 22,235 seconds. Final efficiency: 4.14/sec.

4.136991



2923 2923 11:06:05 11:20:51 0:14
36538 33615 11:20:51 13:13:38 1:52
68255 31717 13:13:38 15:16:42 2:03
91986 23731 15:16:42 17:16:40 1:59

2014/7/9 Afternoon

Optimize content:

Nutch-site

<name>fetcher.threads.per.host</name> 5
<name>fetcher.threads.fetch</name>20

Results:

td> nutch
back
    number
efficiency 5.38/sec allIndex








total number of bars per reply number start end time-consuming speed start End /td> time consuming speed start

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.