You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@knox.apache.org by "Kevin Risden (JIRA)" <ji...@apache.org> on 2017/09/03 15:26:00 UTC

[jira] [Commented] (KNOX-921) Httpclient max connections are always set to default values

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

Kevin Risden commented on KNOX-921:
-----------------------------------

So I've looked into this and found the following:
* InstrHttpClientBuilderProvider sets a connection manager (line 41)
* The connection manager overrides the httpclient builder for max connections/max route
** This is in the httpclient builder javadocs
{code}

    /**
     * Assigns maximum total connection value.
     * <p>
     * Please note this value can be overridden by the {@link #setConnectionManager(
     *   org.apache.http.conn.HttpClientConnectionManager)} method.
     * </p>
     */
    public final HttpClientBuilder setMaxConnTotal(final int maxConnTotal) {
        this.maxConnTotal = maxConnTotal;
        return this;
    }

    /**
     * Assigns maximum connection per route value.
     * <p>
     * Please note this value can be overridden by the {@link #setConnectionManager(
     *   org.apache.http.conn.HttpClientConnectionManager)} method.
     * </p>
     */
    public final HttpClientBuilder setMaxConnPerRoute(final int maxConnPerRoute) {
        this.maxConnPerRoute = maxConnPerRoute;
        return this;
    }
{code}
* There is no way to get the connection manager back from the builder once set

KNOX-784 changed the connection manager from InstrumentedHttpClientConnectionManager to PoolingHttpClientConnectionManager as a "temporary" work around.

Potential solutions:
* If PoolingHttpClientConnectionManager is going to stay in InstrHttpClientBuilderProvider, then there is no reason to set the connection manager and the problem will be fixed.
*  If the connection manager should be InstrumentedHttpClientConnectionManager, then the fix is to set connection limits directly on the connection manager like the following
{code}
connectionManager.setDefaultMaxPerRoute(...);
connectionManager.setMaxTotal(..);
{code}

[~cmirashi] - Did you have a patch that solves the above?
[~sumit.gupta] - Thoughts on this and how it relates to KNOX-784?
[~kminder] - Thoughts since you implemented KNOX-604

> Httpclient max connections are always set to default values
> -----------------------------------------------------------
>
>                 Key: KNOX-921
>                 URL: https://issues.apache.org/jira/browse/KNOX-921
>             Project: Apache Knox
>          Issue Type: Bug
>          Components: Server
>    Affects Versions: 0.11.0
>            Reporter: Chandana Mirashi
>            Assignee: Chandana Mirashi
>             Fix For: 0.14.0
>
>
> When httpclient object gets created it is always set with default number of max connections per route(2) and max connections total(20) irrespective of value set in gateway.httpclient.maxConnections property. 
> When gateway.metrics.enabled property is set to false, only then gateway.httpclient.maxConnections values take effect.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)