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

Add java docs to explain how the max connection settings are used #33

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

amydentremont
Copy link

I could provide code links for these things if you'd rather not just take my word for it, though I think at least @jschlather has looked into this behavior as well and could potentially vouch

@stevegutz @pH14

Copy link
Contributor

@stevie400 stevie400 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems reasonable to me, but I don't know much about this.

Tagging @jhaber + beaast (@kmclarnon @Xcelled @snommit-mit)

public int getMaxConnections() {
return maxConnections;
}

/**
* Unlike maxConnections, the HttpClient will use this per-host setting to IMMEDIATELY FAIL any requests
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: should these variable and class references be javadoc links, eg {@link #getMaxConnections} or w/e? That way people can easily browse the code from this comment.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure I can do that

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh second thought, would it be ok to merge without it? I haven't been able to get back to this (I got locked out of public GH for a month between writing these comments and opening the PR), and this is at least better than having no comments

* instead, a {@link org.asynchttpclient.shaded.exception.TooManyConnectionsPerHostException} is thrown from the client immediately.
*
* Note, {@link #getConnectTimeoutMillis()} doesn't come into play in this connection limiting.
* Instead, the internal `acquireTimeout` is the timeout for acquiring a connection permit;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be connect timeout instead?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, I think what I meant to explain here is that the connect timeout can only come into play after the client has acquired a connection permit, so it's the acquireTimeout defaulting to 0 that causes "The client does NOT block / wait for any amount of time if it gets a request when the max connections per host are already used up" - and since acquireTimeout isn't exposed there's no way to have it not throw immediately when maxConnectionsPerHost is hit. The connect timeout should be for establishing a connection to the API after a connection permit is acquired (technically it could influence connection limiting if it was set way too high, but it isn't part of the immediate failure behavior).
Does that make sense? I could try to reword it if that might help

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

Successfully merging this pull request may close these issues.

2 participants