Re: Keep alive
You can increase the logging level as per the Enable context logging for connection management / request execution instructions listed on http://hc.apache.org/httpcomponents-client-ga/logging.html Alternatively, you could use tcpdump or Wireshark to capture the packets and see if the same TCP connection is being re-used. Thanks, Sam On 31 March 2011 17:12, Joan Balaguero joan.balagu...@grupoventus.com wrote: Hello Oleg, I’ve implemented a Connection Keep Alive strategy in my app, but I’m not able to see what is the better way to check if it’s working ok. Could you give any clue about how to do this? Thanks, Joan. - To unsubscribe, e-mail: httpclient-users-unsubscr...@hc.apache.org For additional commands, e-mail: httpclient-users-h...@hc.apache.org
RE: Keep alive
Hi Joan, I'm also researching on the same area. Could you please provide some details why you are implementing keep alive strategy? In other words, What problems prompted you to implement keep alive strategy? If you could elaborate on your issue, I could share some of my experience and research findings. Thanks, Raj -Original Message- From: Joan Balaguero [mailto:joan.balagu...@grupoventus.com] Sent: Thursday, March 31, 2011 11:13 AM To: 'HttpClient User Discussion' Subject: Keep alive Hello Oleg, I've implemented a Connection Keep Alive strategy in my app, but I'm not able to see what is the better way to check if it's working ok. Could you give any clue about how to do this? Thanks, Joan. _ The information contained in this message is proprietary and/or confidential. If you are not the intended recipient, please: (i) delete the message and all copies; (ii) do not disclose, distribute or use the message in any manner; and (iii) notify the sender immediately. In addition, please be aware that any message addressed to our domain is subject to archiving and review by persons other than the intended recipient. Thank you. _ - To unsubscribe, e-mail: httpclient-users-unsubscr...@hc.apache.org For additional commands, e-mail: httpclient-users-h...@hc.apache.org
RE: Keep alive
Hello, Thanks, it seems to work. Keep-Alive = 10 seconds. First request (creates new connection) Get connection: HttpRoute[{}-http://10.20.30.105:80], timeout = 1 [HttpRoute[{}-http://10.20.30.105:80]] kept alive: 0, issued: 0, allocated: 0 out of 500 No free connections [HttpRoute[{}-http://10.20.30.105:80]][null] Available capacity: 2147483647 out of 2147483647 [HttpRoute[{}-http://10.20.30.105:80]][null] Creating new connection [HttpRoute[{}-http://10.20.30.105:80]] Attempt 1 to execute request Sending request: POST /wsserhs/rhodasol?a=1 HTTP/1.1 Receiving response: HTTP/1.1 200 OK Connection can be kept alive for 1 ms Released connection is reusable. Releasing connection [HttpRoute[{}-http://10.20.30.105:80]][null] Pooling connection [HttpRoute[{}-http://10.20.30.105:80]][null]; keep alive for 1 MILLISECONDS Adding connection at: 1301590475036 Notifying no-one, there are no waiting threads Second request (takes previous connection from pool) Get connection: HttpRoute[{}-http://10.20.30.105:80], timeout = 1 [HttpRoute[{}-http://10.20.30.105:80]] kept alive: 1, issued: 0, allocated: 1 out of 500 Getting free connection [HttpRoute[{}-http://10.20.30.105:80]][null] Attempt 1 to execute request Sending request: POST /wsserhs/rhodasol?a=1 HTTP/1.1 Receiving response: HTTP/1.1 200 OK Connection can be kept alive for 1 ms Released connection is reusable. Releasing connection [HttpRoute[{}-http://10.20.30.105:80]][null] Pooling connection [HttpRoute[{}-http://10.20.30.105:80]][null]; keep alive for 1 MILLISECONDS Adding connection at: 1301590476953 Notifying no-one, there are no waiting threads Third request, after waiting more than 10 seconds (takes previous connection from pool, but it's not alive -- close and create a new one) Get connection: HttpRoute[{}-http://10.20.30.105:80], timeout = 1 [HttpRoute[{}-http://10.20.30.105:80]] kept alive: 1, issued: 0, allocated: 1 out of 500 Getting free connection [HttpRoute[{}-http://10.20.30.105:80]][null] Closing expired free connection [HttpRoute[{}-http://10.20.30.105:80]][null] Connection closed No free connections [HttpRoute[{}-http://10.20.30.105:80]][null] Available capacity: 2147483647 out of 2147483647 [HttpRoute[{}-http://10.20.30.105:80]][null] Creating new connection [HttpRoute[{}-http://10.20.30.105:80]] Attempt 1 to execute request Sending request: POST /wsserhs/rhodasol?a=1 HTTP/1.1 Receiving response: HTTP/1.1 200 OK Connection can be kept alive for 1 ms Released connection is reusable. Releasing connection [HttpRoute[{}-http://10.20.30.105:80]][null] Pooling connection [HttpRoute[{}-http://10.20.30.105:80]][null]; keep alive for 1 MILLISECONDS Adding connection at: 1301590655288 Notifying no-one, there are no waiting threads -Mensaje original- De: Sam Crawford [mailto:samcrawf...@gmail.com] Enviado el: jueves, 31 de marzo de 2011 18:18 Para: HttpClient User Discussion CC: Joan Balaguero Asunto: Re: Keep alive You can increase the logging level as per the Enable context logging for connection management / request execution instructions listed on http://hc.apache.org/httpcomponents-client-ga/logging.html Alternatively, you could use tcpdump or Wireshark to capture the packets and see if the same TCP connection is being re-used. Thanks, Sam On 31 March 2011 17:12, Joan Balaguero joan.balagu...@grupoventus.com wrote: Hello Oleg, Ive implemented a Connection Keep Alive strategy in my app, but Im not able to see what is the better way to check if its working ok. Could you give any clue about how to do this? Thanks, Joan. - To unsubscribe, e-mail: httpclient-users-unsubscr...@hc.apache.org For additional commands, e-mail: httpclient-users-h...@hc.apache.org
RE: Keep alive
Hi Raj, In my case, I'm sending requests to problematic servers. By problematic I mean that they're abruptly closing the http sockets. That's why I'm not interested in keeping alive my http connections for so many time, because after few seconds (~10 seconds), they will be probably closed on the server side. In addition, it's also a good idea to implement an IdleConnection Handler to manage idle connections (and, in the same method, also call to 'closeExpiredConnections', recommendation made by Oleg to me some months ago) and also a 'Retry' handler. With this combination of strategies, you will minimize connection problems (like a 'Connection reset'), but you don't have to expect to solve the problems completely. Using Http protocol, you ALWAYS will lose requests due to connection problems. Regards, Joan. -Mensaje original- De: Vadheraju, Rajeshwar [mailto:rajeshwar.vadher...@fisglobal.com] Enviado el: jueves, 31 de marzo de 2011 18:19 Para: HttpClient User Discussion Asunto: RE: Keep alive Hi Joan, I'm also researching on the same area. Could you please provide some details why you are implementing keep alive strategy? In other words, What problems prompted you to implement keep alive strategy? If you could elaborate on your issue, I could share some of my experience and research findings. Thanks, Raj -Original Message- From: Joan Balaguero [mailto:joan.balagu...@grupoventus.com] Sent: Thursday, March 31, 2011 11:13 AM To: 'HttpClient User Discussion' Subject: Keep alive Hello Oleg, I've implemented a Connection Keep Alive strategy in my app, but I'm not able to see what is the better way to check if it's working ok. Could you give any clue about how to do this? Thanks, Joan. _ The information contained in this message is proprietary and/or confidential. If you are not the intended recipient, please: (i) delete the message and all copies; (ii) do not disclose, distribute or use the message in any manner; and (iii) notify the sender immediately. In addition, please be aware that any message addressed to our domain is subject to archiving and review by persons other than the intended recipient. Thank you. _ - To unsubscribe, e-mail: httpclient-users-unsubscr...@hc.apache.org For additional commands, e-mail: httpclient-users-h...@hc.apache.org - To unsubscribe, e-mail: httpclient-users-unsubscr...@hc.apache.org For additional commands, e-mail: httpclient-users-h...@hc.apache.org
RE: Keep alive
Yes, agreed. I think it is good idea to implement retry and idle connection handler as opposed to keep alive strategy. How did you implement or use idle connection thread? I am using xfire as my soap framework which uses MultiThreadedConnectionManager internally, not sure how to tell xfire to use or run IdleConenction Thread? -Original Message- From: Joan Balaguero [mailto:joan.balagu...@grupoventus.com] Sent: Thursday, March 31, 2011 12:50 PM To: Vadheraju, Rajeshwar Cc: 'HttpClient User Discussion' Subject: RE: Keep alive Hi Raj, In my case, I'm sending requests to problematic servers. By problematic I mean that they're abruptly closing the http sockets. That's why I'm not interested in keeping alive my http connections for so many time, because after few seconds (~10 seconds), they will be probably closed on the server side. In addition, it's also a good idea to implement an IdleConnection Handler to manage idle connections (and, in the same method, also call to 'closeExpiredConnections', recommendation made by Oleg to me some months ago) and also a 'Retry' handler. With this combination of strategies, you will minimize connection problems (like a 'Connection reset'), but you don't have to expect to solve the problems completely. Using Http protocol, you ALWAYS will lose requests due to connection problems. Regards, Joan. -Mensaje original- De: Vadheraju, Rajeshwar [mailto:rajeshwar.vadher...@fisglobal.com] Enviado el: jueves, 31 de marzo de 2011 18:19 Para: HttpClient User Discussion Asunto: RE: Keep alive Hi Joan, I'm also researching on the same area. Could you please provide some details why you are implementing keep alive strategy? In other words, What problems prompted you to implement keep alive strategy? If you could elaborate on your issue, I could share some of my experience and research findings. Thanks, Raj -Original Message- From: Joan Balaguero [mailto:joan.balagu...@grupoventus.com] Sent: Thursday, March 31, 2011 11:13 AM To: 'HttpClient User Discussion' Subject: Keep alive Hello Oleg, I've implemented a Connection Keep Alive strategy in my app, but I'm not able to see what is the better way to check if it's working ok. Could you give any clue about how to do this? Thanks, Joan. _ The information contained in this message is proprietary and/or confidential. If you are not the intended recipient, please: (i) delete the message and all copies; (ii) do not disclose, distribute or use the message in any manner; and (iii) notify the sender immediately. In addition, please be aware that any message addressed to our domain is subject to archiving and review by persons other than the intended recipient. Thank you. _ - To unsubscribe, e-mail: httpclient-users-unsubscr...@hc.apache.org For additional commands, e-mail: httpclient-users-h...@hc.apache.org _ The information contained in this message is proprietary and/or confidential. If you are not the intended recipient, please: (i) delete the message and all copies; (ii) do not disclose, distribute or use the message in any manner; and (iii) notify the sender immediately. In addition, please be aware that any message addressed to our domain is subject to archiving and review by persons other than the intended recipient. Thank you. _ - To unsubscribe, e-mail: httpclient-users-unsubscr...@hc.apache.org For additional commands, e-mail: httpclient-users-h...@hc.apache.org