Improve assignment of "PublicationsRetriever.threadsMultiplier", depending on the total available threads on the system. The previous assignment was not scaling well.
This commit is contained in:
parent
4976afa829
commit
d682298850
|
@ -53,8 +53,13 @@ public class PublicationsRetrieverPlugin {
|
||||||
ConnSupportUtils.shouldBlockMost5XXDomains = false;
|
ConnSupportUtils.shouldBlockMost5XXDomains = false;
|
||||||
LoaderAndChecker.setCouldRetryRegex();
|
LoaderAndChecker.setCouldRetryRegex();
|
||||||
|
|
||||||
|
int availableProcessors = Runtime.getRuntime().availableProcessors();
|
||||||
|
if ( availableProcessors <= 4 )
|
||||||
PublicationsRetriever.threadsMultiplier = 10;
|
PublicationsRetriever.threadsMultiplier = 10;
|
||||||
int workerThreadsCount = (Runtime.getRuntime().availableProcessors() * PublicationsRetriever.threadsMultiplier);
|
else
|
||||||
|
PublicationsRetriever.threadsMultiplier = 6;
|
||||||
|
|
||||||
|
int workerThreadsCount = (availableProcessors * PublicationsRetriever.threadsMultiplier);
|
||||||
logger.info("Use " + workerThreadsCount + " worker-threads.");
|
logger.info("Use " + workerThreadsCount + " worker-threads.");
|
||||||
PublicationsRetriever.executor = Executors.newFixedThreadPool(workerThreadsCount);
|
PublicationsRetriever.executor = Executors.newFixedThreadPool(workerThreadsCount);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue