Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
vitalus opened this issue Aug 18, 2024 · 0 comments

Comments

@vitalus
Copy link

vitalus commented Aug 18, 2024

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant