apache / apache/maven-resolver

Enable connection pooling with UrlTransporter

Open
#1,974 1 comment 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Java
Stars
152
Forks
160
Avg merge
1d 4h
Merged PRs (30d)
49

Description

### New feature, improvement proposal

Currently each connection being established via the UrlTransporter is unconditionally released for example in https://github.com/apache/maven-resolver/blob/45482a82ce0377d0c7a0d8fc343eeff6b94012ad/maven-resolver-transport-url/src/main/java/org/eclipse/aether/transport/url/UrlTransporter.java#L251. Although this is safe in terms of releasing the http connection it would also prevent connection pooling.

Instead one should rather just close the returned input streams. Compare with the Javadoc in https://docs.oracle.com/javase/8/docs/api/java/net/HttpURLConnection.html.

It is important though to close both [regular](https://docs.oracle.com/javase/8/docs/api/java/net/URLConnection.html#getInputStream--) and potentially also [error input stream](https://docs.oracle.com/javase/8/docs/api/java/net/HttpURLConnection.html#getErrorStream--).

Particularly as TLS handshakes are expensive connection pooling usually has a big performance impact.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in maven-resolver-transport-url/src/main/java/org/eclipse/aether/transport/url/UrlTransporter.java around line 251, and compare the connection lifecycle with the Java URLConnection and HttpURLConnection Javadocs. Verify how regular and error input streams are obtained and closed. Done means the transporter no longer unconditionally releases each connection, while both possible input streams are closed so connection pooling can work.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
networking
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.