2010-03-17 46 views
1

如何同時處理與主機的多個連接?同時處理與主機的多個連接

+1

這很大程度上取決於'這=你遇到的問題'是!請擴大! – lexu 2010-03-17 07:16:12

+0

我使用nutch在hadoop上構建搜索引擎。我生成了段來獲取(〜1 000 000頁)。當我運行fetcher連接到主機的連接數在300左右時,我怎樣才能限制它呢? P.S.對不起我的英語不好 – sev 2010-03-17 07:29:03

回答

0

從的nutch-default.xml中:

<property> 
    <name>fetcher.threads.fetch</name> 
    <value>10</value> 
    <description>The number of FetcherThreads the fetcher should use. 
    This is also determines the maximum number of requests that are 
    made at once (each FetcherThread handles one connection).</description> 
</property> 

<property> 
    <name>fetcher.threads.per.host</name> 
    <value>1</value> 
    <description>This number is the maximum number of threads that 
    should be allowed to access a host at one time.</description> 
</property> 

如上所述,連接的數量是最多等於線程的數目。第一個屬性控制連接的總數,第二個屬性控制每個主機的連接數 - 這是您需要設置的連接數。