ffang commented on PR #3725:
URL: https://github.com/apache/cxf/pull/3725#issuecomment-6952051513

   > > AsyncHTTPConduitFactory shares one hc5 client between the conduits with 
the same HTTPClientPolicy instance, but closing any of these conduits shut the 
client down.
   > 
   > Thanks [@ffang](https://github.com/ffang) , the issue with 
`HttpClientHTTPConduit` that led to shared client is that JDK's HttpClient is 
very heavy (and thread hungry), so we practically could not create one per 
conduit. The `AsyncHTTPConduit` does not need sharing and will benefit greatly 
for simpler model I believe (to have client per conduit), it will also get rid 
of complexity and reference tracking (which is often causing more issue down 
the line), wdyt?
   > 
   > Thank you
   
   Thanks @reta, agreed, it is simpler: I've pushed a commit 
https://github.com/apache/cxf/pull/3725/changes/f6eee53e9a7b478f3fef45e19c24babf321e82c8
 that gives each conduit its own hc5 client, shut down on `close()`, with no 
sharing and no reference counting.
   
   - The default `HTTPClientPolicy` is created per conduit (and 
`<http-conf:conduit>` gives each conduit its own), so most users already had a 
client per conduit. Only conduits configured with the same policy instance, 
e.g. through `HttpConduitFeature` or `setClient(policy)`, now get a client each.
   - The factory keeps the clients only to shut them down (bus shutdown, 
`update()`) and to apply the connection limits.
   - `setupNIOClient()` and `close(HTTPClientPolicy)` are deprecated no-ops, to 
keep the API for the maintenance branches.
   - I also checked camel-cxf: it never shares a policy, so it already gets a 
client per conduit and nothing changes there.
   
   The trade-off: users who share one policy across many conduits get more 
threads (by default one I/O thread per CPU, plus 2, for each client). 
`org.apache.cxf.transport.http.async.ioThreadCount` reduces that if needed.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to