Increased new connection rate

2022-11-29 Thread John.E.Gregg
All,

I'm using 4.5.12.

I'm trying to reproduce a problem where it appears we're creating a lot more 
new backend connections than we expect even though incoming request volume 
stays about the same.

I have max per route set to 5 and have confirmed with enabling debug on 
PoolingHttpClientConnectionManager that the max is in fact 5.  There is only 
one route.

The TTL is set to 2 minutes and that also seems to work as advertised.  AFAIK 
the backend does not close connections by sending "connection: close" or any 
other means, though that's not 100% confirmed.

Taking a guess that connect or read timeouts could cause a connection to get 
closed (and a new one opened,) I added artificial latency to the backend 
responses to trigger timeouts.  That did cause the connection creation rate to 
rise above the steady state.  However it also appears to have caused more than 
5 connections to be in an "established" state at once according to netstat.  It 
wasn't unusual to see 2-3x as many established connections.  Because of the 
primitive way I'm counting open connections, the actual connection creation 
rate could be even higher.

I'm looking for suggestions on what could cause:


  *   Increased connection creation rate
  *   Established connection counts higher than the pool size

Thanks



RE: problem with high CPU in app using http-components

2022-02-22 Thread John.E.Gregg
Chris,

Take a java flight recording on the server.  If you enable recording of TLS 
handshakes (it's off by default,) you can see them under the event browser in 
Mission Control.  If you start the recording via Mission Control, you have to 
hit "next" a couple of times in the "start window" to get to a tree view where 
you can enable it.  In the tree it's under Java Development Kit | Security | 
TLS Handshake.  If you start from the command line, you either need to update 
the JDK's profile.jfc/default.jfc file or add an additional config file to 
enable TLS handshake recording:


  true
  true


I would expect the number of handshakes to be low because clients should be 
reusing their connections.

Method sampling is enabled by default and will give you can idea what's using 
the CPU.

Good luck


> -Original Message-
> From: Chris Whitaker 
> Sent: Friday, February 18, 2022 10:38 AM
> To: httpclient-users@hc.apache.org
> Subject: problem with high CPU in app using http-components
> 
> Hi there;
> 
> I hope this is a good place to ask about some issues I am facing.
> 
> I have a java app [on a linux vm] with an https server which waits for and
> responds to requests from clients [using http-components v4.4.15].
> Everything seems to function well enough but occasionally something occurs
> which is causing increased CPU load.
> 
> I suspect it has to do with the TLS connection being torn down from both
> sides causing some issues.  Any advice on how I should proceed would be
> appreciated.
> 
> Chris

-
To unsubscribe, e-mail: httpclient-users-unsubscr...@hc.apache.org
For additional commands, e-mail: httpclient-users-h...@hc.apache.org