HTTP Connection pooling in Apache CXF

2019-04-25 08:00发布

问题:

I am trying to check whether Apache CXF implements HTTP Connection Pooling? If yes, how can we configure the same. If not, how can we achieve the same?

This thread is little direction towards the same. But it's not clear whether HTTPConduit has a way to set the same or properly configure.

Can anyone guide me on this?

回答1:

Apache CXF uses HTTPUrlConnection internally and relies on java system properties to configure client connection settings.

Two main ones that you can configure are as follows:

  1. http.keepAlive (default: true) - Indicates if persistent connections should be supported. They improve performance by allowing the underlying socket connection to be reused for multiple http requests. If this is set to true then persistent connections will be requested with HTTP 1.1 servers.

  2. http.maxConnections (default: 5) - If HTTP keepalive is enabled (see above) this value determines the maximum number of idle connections that will be simultaneously kept alive, per destination.

Here is a list of all the properties that you can set to configure HTTPUrlConnection

Hope it helps.