[ 
https://issues.apache.org/jira/browse/CAMEL-10240?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15465611#comment-15465611
 ] 

ASF GitHub Bot commented on CAMEL-10240:
----------------------------------------

GitHub user tkopczynski opened a pull request:

    https://github.com/apache/camel/pull/1157

    CAMEL-10240: Fix for thread pool sizes in CamelHttpClient

    Fixes CAMEL-10240.
    
    Things I did:
    
    - Removed setting the `QueuedThreadPool` size to 16 in `CamelHttpClient`. 
Now it relies on defaults in `QueuedThreadPool` class itself.
    
    - Added a constructor in `CamelHttpClient` for setting 
`HttpClientTransport`.
    
    - If the `httpClientMaxThreads` parameter is set, it becomes the selectors 
number for the `HttpClientTransport` instance. I'm not sure about this one but 
I thought it might be good to enable the possibility to configure this instead 
of having the dependency on `Runtime.getRuntime().availableProcessors()` for 
all cases. But maybe it would be better to create a new parameter for this?


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/tkopczynski/camel camel-10240

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/camel/pull/1157.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #1157
    
----
commit 6f12d971fe55738ee6f1e96b33917cd230d8af99
Author: Tomasz Kopczynski <[email protected]>
Date:   2016-09-05T18:55:04Z

    CAMEL-10240: Fix for thread pool sizes in CamelHttpClient

----


> CamelHttpClient default pool size does not work on system with large number 
> of cpus
> -----------------------------------------------------------------------------------
>
>                 Key: CAMEL-10240
>                 URL: https://issues.apache.org/jira/browse/CAMEL-10240
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-jetty
>    Affects Versions: 2.17.2
>            Reporter: Zoltan Farkas
>
> In CamelHttpClient a default threadpool is being created with a hardcoded 
> size of 16:
> {code}
>     @Override
>     protected void doStart() throws Exception {
>         if (!hasThreadPool()) {
>             // if there is no thread pool then create a default thread pool 
> using daemon threads
>             QueuedThreadPool qtp = new QueuedThreadPool();
>             // 16 max threads is the default in the http client
>             qtp.setMaxThreads(16);
>             qtp.setDaemon(true);
>             // let the thread names indicate they are from the client
>             qtp.setName("CamelJettyClient(" + 
> ObjectHelper.getIdentityHashCode(this) + ")");
>             setThreadPoolOrExecutor(qtp);
>         }
>         super.doStart();
>     }
> {code}
> this configuration does not work because number of selectors is calculated 
> relative to the number of CPUs in HttpClientTransportOverHTTP:
> {code}
>    public HttpClientTransportOverHTTP()
>     {
>         this(Math.max(1, Runtime.getRuntime().availableProcessors() / 2));
>     }
> {code}
> As a result by default camel simply hangs on these systems...
> It would be nice if CamelHttpClient would have a constructor that set the 
> HttpClientTransport or at least the number of selectors.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to