Package org.apache.solr.ltr
Class LTRThreadModule
- java.lang.Object
-
- org.apache.solr.core.CloseHook
-
- org.apache.solr.ltr.LTRThreadModule
-
- All Implemented Interfaces:
NamedListInitializedPlugin
public final class LTRThreadModule extends CloseHook implements NamedListInitializedPlugin
The LTRThreadModule is optionally used by theLTRQParserPluginandLTRFeatureLoggerTransformerFactoryclasses to parallelize the creation ofFeature.FeatureWeightobjects.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 settotalPoolThreadsandnumThreadsPerRequestto the same value. If multiple queries need to be serviced simultaneously thentotalPoolThreadsandnumThreadsPerRequestcan be adjusted based on the expected response times. If the value ofnumThreadsPerRequestis higher, the response time for a single query will be improved up to a point. If multiple queries are serviced simultaneously, the value oftotalPoolThreadsimposes a contention between the queries if(totalPoolThreads < numThreadsPerRequest * total parallel queries).
-
-
Constructor Summary
Constructors Constructor Description LTRThreadModule()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidacquireLTRSemaphore()SemaphorecreateQuerySemaphore()voidexecute(Runnable command)static LTRThreadModulegetInstance(NamedList args)voidinit(NamedList args)voidpostClose(SolrCore core)voidpreClose(SolrCore core)voidreleaseLTRSemaphore()voidsetExecutor(ExecutorService sharedExecutor)voidsetNumThreadsPerRequest(int numThreadsPerRequest)voidsetTotalPoolThreads(int totalPoolThreads)
-
-
-
Method Detail
-
getInstance
public static LTRThreadModule getInstance(NamedList args)
-
init
public void init(NamedList args)
- Specified by:
initin interfaceNamedListInitializedPlugin
-
setTotalPoolThreads
public void setTotalPoolThreads(int totalPoolThreads)
-
setNumThreadsPerRequest
public void setNumThreadsPerRequest(int numThreadsPerRequest)
-
createQuerySemaphore
public Semaphore createQuerySemaphore()
-
acquireLTRSemaphore
public void acquireLTRSemaphore() throws InterruptedException- Throws:
InterruptedException
-
releaseLTRSemaphore
public void releaseLTRSemaphore() throws InterruptedException- Throws:
InterruptedException
-
execute
public void execute(Runnable command)
-
setExecutor
public void setExecutor(ExecutorService sharedExecutor)
-
-