I saw the following comments in ClientConnection.java
A client connection. This can be used to send requests, or to upgrade the
In general these objects are not thread safe, they should only be used by
the IO thread that is responsible for the connection. As a result this
client does not provide a mechanism to perform blocking IO, it is designed
for async operation only.
The above comments made me to rethink what I have done with the
UndertowClient. I basically created a wrapper on top of UndertowClient so
that I can have one service calling another service with an HTTP 2.0
connection shared by multiple requests. As I understand the HTTP 2.0
connection supports multiplex so that you can have multiple requests sent
in the same channel in parallel.
Here is one of my examples and I have done some preliminary performance
test without any issue. I am wondering if I should cache the connect as
instance variable instead of static variable of HttpHandler.
Also, I realized that if downstream server is not in HTTP 2.0, then I need
to have a connection pool built in order to get better performance. Does
anybody have some example of HTTP connection pool implementation?