mirror of https://github.com/apache/lucene.git
SOLR-850 -- Addition of timeouts for distributed searching. Configurable through 'shard-socket-timeout' and 'shard-connection-timeout' parameters in SearchHandler.
git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@741710 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
8391810098
commit
23099323d5
|
@ -150,6 +150,9 @@ New Features
|
|||
34. SOLR-943: Make it possible to specify dataDir in solr.xml and accept the dataDir as a request parameter for
|
||||
the CoreAdmin create command. (Noble Paul via shalin)
|
||||
|
||||
25. SOLR-850: Addition of timeouts for distributed searching. Configurable through 'shard-socket-timeout' and
|
||||
'shard-connection-timeout' parameters in SearchHandler. (Patrick O'Leary via shalin)
|
||||
|
||||
|
||||
Optimizations
|
||||
----------------------
|
||||
|
|
|
@ -55,6 +55,18 @@ public class SearchHandler extends RequestHandlerBase implements SolrCoreAware
|
|||
static final String INIT_FIRST_COMPONENTS = "first-components";
|
||||
static final String INIT_LAST_COMPONENTS = "last-components";
|
||||
|
||||
// socket timeout measured in ms, closes a socket if read
|
||||
// takes longer than x ms to complete. throws
|
||||
// java.net.SocketTimeoutException: Read timed out exception
|
||||
static final String INIT_SO_TIMEOUT = "shard-socket-timeout";
|
||||
|
||||
// connection timeout measures in ms, closes a socket if connection
|
||||
// cannot be established within x ms. with a
|
||||
// java.net.SocketTimeoutException: Connection timed out
|
||||
static final String INIT_CONNECTION_TIMEOUT = "shard-connection-timeout";
|
||||
static int soTimeout = 0; //current default values
|
||||
static int connectionTimeout = 0; //current default values
|
||||
|
||||
protected static Logger log = LoggerFactory.getLogger(SearchHandler.class);
|
||||
|
||||
protected List<SearchComponent> components = null;
|
||||
|
@ -124,6 +136,18 @@ public class SearchHandler extends RequestHandlerBase implements SolrCoreAware
|
|||
components.add(dbgCmp);
|
||||
log.info("Adding debug component:" + dbgCmp);
|
||||
}
|
||||
|
||||
Object co = initArgs.get(INIT_CONNECTION_TIMEOUT);
|
||||
if (co != null) {
|
||||
connectionTimeout = (Integer) co;
|
||||
log.info("Setting shard-connection-timeout to: " + connectionTimeout);
|
||||
}
|
||||
|
||||
Object so = initArgs.get(INIT_SO_TIMEOUT);
|
||||
if (so != null) {
|
||||
soTimeout = (Integer) so;
|
||||
log.info("Setting shard-socket-timeout to: " + soTimeout);
|
||||
}
|
||||
}
|
||||
|
||||
public List<SearchComponent> getComponents() {
|
||||
|
@ -334,6 +358,8 @@ class HttpCommComponent {
|
|||
MultiThreadedHttpConnectionManager mgr = new MultiThreadedHttpConnectionManager();
|
||||
mgr.getParams().setDefaultMaxConnectionsPerHost(20);
|
||||
mgr.getParams().setMaxTotalConnections(10000);
|
||||
mgr.getParams().setConnectionTimeout(SearchHandler.connectionTimeout);
|
||||
mgr.getParams().setSoTimeout(SearchHandler.soTimeout);
|
||||
// mgr.getParams().setStaleCheckingEnabled(false);
|
||||
client = new HttpClient(mgr);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue