Package org.apache.solr.ltr
Class LTRThreadModule
java.lang.Object
org.apache.solr.ltr.LTRThreadModule
- All Implemented Interfaces:
NamedListInitializedPlugin
The LTRThreadModule is optionally used by the
LTRQParserPlugin
and LTRFeatureLoggerTransformerFactory classes to parallelize the creation of Feature.FeatureWeight objects.
Example configuration:
<queryParser name="ltr" class="org.apache.solr.ltr.search.LTRQParserPlugin"> <int name="threadModule.totalPoolThreads">10</int> <int name="threadModule.numThreadsPerRequest">5</int> </queryParser> <transformer name="features" class="org.apache.solr.ltr.response.transform.LTRFeatureLoggerTransformerFactory"> <int name="threadModule.totalPoolThreads">10</int> <int name="threadModule.numThreadsPerRequest">5</int> </transformer>If an individual solr instance is expected to receive no more than one query at a time, it is best to set
totalPoolThreads and numThreadsPerRequest to the same
value.
If multiple queries need to be serviced simultaneously then totalPoolThreads and
numThreadsPerRequest can be adjusted based on the expected response times.
If the value of numThreadsPerRequest is higher, the response time for a single
query will be improved up to a point. If multiple queries are serviced simultaneously, the value
of totalPoolThreads imposes a contention between the queries if
(totalPoolThreads < numThreadsPerRequest * total parallel queries).
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidstatic LTRThreadModulegetInstance(org.apache.solr.common.util.NamedList<?> args) voidinit(org.apache.solr.common.util.NamedList<?> args) voidvoidsetExecutor(ExecutorService sharedExecutor) voidsetNumThreadsPerRequest(int numThreadsPerRequest) voidsetTotalPoolThreads(int totalPoolThreads)
-
Constructor Details
-
LTRThreadModule
public LTRThreadModule()
-
-
Method Details
-
getInstance
-
init
public void init(org.apache.solr.common.util.NamedList<?> args) - Specified by:
initin interfaceNamedListInitializedPlugin
-
setTotalPoolThreads
public void setTotalPoolThreads(int totalPoolThreads) -
setNumThreadsPerRequest
public void setNumThreadsPerRequest(int numThreadsPerRequest) -
createQuerySemaphore
-
acquireLTRSemaphore
- Throws:
InterruptedException
-
releaseLTRSemaphore
- Throws:
InterruptedException
-
execute
-
setExecutor
-