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

Fixes #2828 - AbstractHTTP2ServerConnectionFactory concurrent connect low performance. #2831

Merged

Conversation

sbordet
Copy link
Contributor

@sbordet sbordet commented Aug 19, 2018

Now HTTP/2 sessions are not added to the Jetty component tree,
but rather just held by HTTP2SessionContainer that is added to
the Jetty container tree at startup.

HTTP2SessionContainer uses a concurrent Set to hold HTTP/2 sessions
to have good add/remove performance.

Signed-off-by: Simone Bordet simone.bordet@gmail.com

… low performance.

Now HTTP/2 sessions are not added to the Jetty component tree,
but rather just held by HTTP2SessionContainer that is added to
the Jetty container tree at startup.

HTTP2SessionContainer uses a concurrent Set to hold HTTP/2 sessions
to have good add/remove performance.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
addManaged((LifeCycle)((HTTP2Connection)connection).getSession());
Session session = ((HTTP2Connection)connection).getSession();
sessions.add(session);
LifeCycle.start(session);
Copy link
Contributor

Choose a reason for hiding this comment

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

if start throws an exception, will onClosed be called to remove it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Historically, if an exception was thrown from a Connection.Listener we let it unwind the stack, which I don't think it's ideal.
I think such listeners should be wrapped in try/catch, log the exception and continue.
So either we wrap, or we leave it as is. I'm for wrapping.

Copy link
Contributor

Choose a reason for hiding this comment

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

log and continue

Copy link
Contributor

@gregw gregw left a comment

Choose a reason for hiding this comment

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

Other than my quibbles, LGTM

@@ -245,18 +252,43 @@ protected ServerParser newServerParser(Connector connector, ServerParser.Listene
return new ServerParser(connector.getByteBufferPool(), listener, getMaxDynamicTableSize(), getHttpConfiguration().getRequestHeaderSize());
}

private class ConnectionListener implements Connection.Listener
private class HTTP2SessionContainer implements Connection.Listener, Dumpable
Copy link
Contributor

Choose a reason for hiding this comment

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

make this a ManagedObject and dump() a ManagedOperation, so we can dump just the sessions from JMX. Also make the size of the sessions collection a managed attribute.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good suggestions, will do.

… low performance.

Improved JMX for the HTTP2SessionContainer.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
@sbordet sbordet merged commit 6015ad5 into jetty-9.4.x Aug 22, 2018
@sbordet sbordet deleted the jetty-9.4.x-2828-http2_connection_listener_contention branch August 22, 2018 14:21
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