svn commit: r1817040 - in /ofbiz/ofbiz-framework/trunk/framework/service: config/serviceengine.xml src/main/java/org/apache/ofbiz/service/config/model/ThreadPool.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r1817040 - in /ofbiz/ofbiz-framework/trunk/framework/service: config/serviceengine.xml src/main/java/org/apache/ofbiz/service/config/model/ThreadPool.java

jleroux@apache.org
Author: jleroux
Date: Sun Dec  3 16:16:24 2017
New Revision: 1817040

URL: http://svn.apache.org/viewvc?rev=1817040&view=rev
Log:
Documented: Document how the thread-pool max-threads works
(OFBIZ-10002)

Minimalist documentation with reference to stackoverflow itself referencing
Brian Goetz's and co's "Java Concurrency in Practice" after discussion at
http://markmail.org/message/ksutqpuyyd4kmbl2

Modified:
    ofbiz/ofbiz-framework/trunk/framework/service/config/serviceengine.xml
    ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/config/model/ThreadPool.java

Modified: ofbiz/ofbiz-framework/trunk/framework/service/config/serviceengine.xml
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/service/config/serviceengine.xml?rev=1817040&r1=1817039&r2=1817040&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/service/config/serviceengine.xml (original)
+++ ofbiz/ofbiz-framework/trunk/framework/service/config/serviceengine.xml Sun Dec  3 16:16:24 2017
@@ -26,6 +26,8 @@ under the License.
         <authorization service-name="userLogin"/>
 
         <!-- Job poller configuration. Many of these attributes are set to the job poller defaults, but they are included here for convenience. -->
+        <!-- About max-threads: 5 has been chosen when most processors had 4 cores
+             see https://stackoverflow.com/questions/13834692/threads-configuration-based-on-no-of-cpu-cores for more -->
         <thread-pool send-to-pool="pool"
                      purge-job-days="4"
                      failed-retry-min="3"

Modified: ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/config/model/ThreadPool.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/config/model/ThreadPool.java?rev=1817040&r1=1817039&r2=1817040&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/config/model/ThreadPool.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/config/model/ThreadPool.java Sun Dec  3 16:16:24 2017
@@ -38,7 +38,7 @@ public final class ThreadPool {
 
     public static final int FAILED_RETRY_MIN = 30;
     public static final int MIN_THREADS = 1; // Must be no less than one or the executor will shut down.
-    public static final int MAX_THREADS = 5; // Values higher than 5 might slow things down.
+    public static final int MAX_THREADS = Runtime.getRuntime().availableProcessors() + 1; // See https://stackoverflow.com/questions/13834692/threads-configuration-based-on-no-of-cpu-cores for more
     public static final int POLL_WAIT = 30000; // Database polling interval - 30 seconds.
     public static final int PURGE_JOBS_DAYS = 30;
     public static final int QUEUE_SIZE = 100;