Skip to content

A parameter "concurrency" from geowebcache.xml is never used as it is "designed" for.. #1309

Open
@vitalus

Description

Parameter value from XML goes to org.apache.http.impl.client.HttpClientBuilder's maxConnTotal.

This is GWC's HttpClientBuilder:


    public HttpClientBuilder(
            URL url,
            Integer backendTimeout,
            String httpUsername,
            String httpPassword,
            URL proxyUrl,
            int concurrency) {
        if (url != null) {
            this.setHttpCredentials(
                    httpUsername, httpPassword, new AuthScope(url.getHost(), url.getPort()));
        } else {
            this.setHttpCredentials(httpUsername, httpPassword, AuthScope.ANY);
        }
        this.setBackendTimeout(backendTimeout);
        setConnectionConfig(
                RequestConfig.custom()
                        .setCookieSpec(CookieSpecs.DEFAULT)
                        .setExpectContinueEnabled(true)
                        .setSocketTimeout(backendTimeoutMillis)
                        .setConnectTimeout(backendTimeoutMillis)
                        .setRedirectsEnabled(true)
                        .build());
                
        clientBuilder = org.apache.http.impl.client.HttpClientBuilder.create();
        clientBuilder.useSystemProperties();
        clientBuilder.setConnectionManager(connectionManager);
        clientBuilder.setMaxConnTotal(concurrency);
        
    }

Because connectionManager is made as static singleton and it's set to org.apache.http.impl.client.HttpClientBuilder then clientBuilder.setMaxConnTotal(concurrency) never has any effect internally in org.apache.http.impl.client.HttpClientBuilder (check Apache HttpComponents code..)

A default value 20 is applied somewhere within HttpComponents and concurrency parameter has no any effect.

The way how connectionManager is prepared (as static singleton) actually breaks a contract of concurrency parameter being configured for every WMS layer in geowebcache.xml.. It's just useless.

In the end I would like to see a control on maxConnectionPerRoute parameter being configurable, as default value 2 (like in browsers) might be a bottleneck for performant environment with GWC generating tiles for many layers on the fly from GeoServer installed side-by-side (whether with embedded or standalone GWC).

concurrency parameter with singleton connection manager (pool of connections) then should be anyway somewhere outside of wmsLayer in geowebcache.xml (looks like it's global setting). As any additional parameter to configure max connections per route (especially when root is side-by-side installed GeoServer , for example, on localhost and we now that 6 conections instead of 2 are ok)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions