Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

HTTP Connection pooling  RSS feed

 
Stephen King
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear All,

I have a very basic question out here. I have a java code which calls another application over HTTP. Using the URL and the port, the code opens a HTTP connection and closes it once done.

The application is supposed to support highly concurrent load in production. We are wondering if any caching/pooling can be implemented for HTTP connections.

Can anybody on this forum share if there is any solution to address this requirement.

Thanks for your time & views.

Cheers,
Steve
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HTTP connections are different from (e.g.) database connections, in that they are closed after a request/response is finished, because HTTP is a stateless protocol. Thus, pools of connections aren't really the answer to getting better performance out of HTTP.

HTTP 1.1 has a feature called keep-alive, though, which can keep a connection open for several requests in a row. That can be used to up performance if requests can be fired quickly enough. Browsers use it to retrieve all the resources referenced by a web page (images, JS, CSS) after the page itself has been loaded.
 
Stephen King
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ulf,

Thanks for sharing your views with me. As you have said in your reply, true pooling (as possible for DB connections) is not possible for HTTP connections. However, 'reuse' to a _certain extent_ is possible.

Could you please provide more details as to how this can be done in the client program. Can any opensource library help me here (jakarta.commons.HTTPClient?)

Many thanks again for your time & help.

Cheers,
Steve
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think it can. Have a look at the "Connection persistence" and "Stale connection check" paragraphs here.
 
Stephen King
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Ulf,

Your inputs were really valuable to me.

Regards,
Steve
 
Stephen King
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Ulf,

Your inputs were really valuable to me.

Regards,
Steve
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!