I've discovered the http.maxConnections property for JAX-WS. I understand the default is 5 connections, but I am confused as to why my JAX-WS client is opening more that 5 socket connections if there is a max and http.keepAlive is true?
If anyone could point me in the right direction or let me know if I misunderstood this setting, that would be very appreciated!
I'm hoping to avoid writing a pool for the jax-ws client to limit the number of socket connections.
Previously I used axis2. It has an option HTTPConstants.REUSE_HTTP_CLIENT so it would only use one connection over and over. Perhaps JAX-WS has a similar option?
Figured it out.
The http.maxConnection settings is not a limit on the total connections but rather the maximum connections to keep open after they were used.
In my case I consistently have 10 simultaneous requests. So 10 would open, 5 would close, 5 more would open, 5 more would close, and so on. Those that close stay in the TIME_WAIT state for 60 seconds (OS Configuration). This causes TIME_WAIT connections to build up quickly to around ~600. By increasing the maximum idle connections (http.maxConnections) to something larger like 20, open connections are now around 10-13.
Axis2 only opens one connection per port instance (no pool) whereas JAX-WS pools multiple connections as they are needed.