[ https://issues.apache.org/jira/browse/NUTCH-1941?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14378821#comment-14378821 ]
Sebastian Nagel commented on NUTCH-1941: ---------------------------------------- Great, that's a step forward. Before going into details (and testing), let's discuss whether we should solve the problem by # for a list of agent names <a,b,c> take r₁ times a, r₂ times b, r₃ times c (r being a random number) # or, alternatively, just choose a random element from <a,b,c> every time an agent name is needed The task is to change the agent name (ev. in a manner which is hard to detect). Both solutions are applicable but solution 2 seems to have a couple of advantages: - it's much easier to implement, e.g. (untested draft given that userAgentNames is already filled): {code} public String getUserAgent() { if (userAgentNames != null) { // choose one of alternative agents int i = ThreadLocalRandom.current().nextInt(0, userAgentNames.size()); return userAgentNames.get(i); } return userAgent; } {code} - no synchronization required. Solution 1 would need synchronization: it may be sensitive to race conditions, but also the visibility of variables shared between Fetcher threads matters. - to make agent names unevenly distributed: just add some names multiple times to the list. Because names are randomly chosen the ordering in the file does not matter. > Optional rolling http.agent.name's > ---------------------------------- > > Key: NUTCH-1941 > URL: https://issues.apache.org/jira/browse/NUTCH-1941 > Project: Nutch > Issue Type: New Feature > Components: fetcher, protocol > Reporter: Lewis John McGibbney > Priority: Trivial > Attachments: NUTCH-1941-ITR2.patch, NUTCH-1941-itr3.patch, > NUTCH-1941-ver1.patch, agent.names.txt, nutch.patch > > > In some scenarios, even whilst adhering to fetcher.crawl.delay, web admins > can block your fetcher based merely on your crawler name. > I propose the ability to implement rolling http.agent.name's which could be > substituted every 5 seconds for example. This would mean that successive > requests to the same domain would be sent with different http.agent.name. > This behavior should be off by default. -- This message was sent by Atlassian JIRA (v6.3.4#6332)