views:

763

answers:

3

In my webservice, I need to place some HTTP calls. Is it possible to do some connection pooling, like I do JDBC connection pooling?

In the Admin Console of GlassFish I see the configuration items Connector Connection Pool and Connector Resources. Can I use these?

A: 

This blog post and whitepaper on GlassFish Performance Tuning may help:

John Clingan GlassFish Group Product Manager Sun Microsystems

John Clingan
From what I can see, that blog post is about HTTP-listeners, as in HTTP server. I need something for an HTTP client.
doekman
+1  A: 

No. For HTTP you don't actually need connection pooling (except if you are a browser). A HTTP connection is much cheaper than a database connection.

However, You can use a custom resource, so you can configure the connection in JNDI. This article helped me out. There are also three follow up posts.

doekman
What is it about being a browser that makes you need a connection pool where other HTTP clients do not?
slim
+2  A: 

doekman's answer is one possible approach.

Over in my company, we just use Apache Commons' HTTPClient library, which has its own connection pool manager. This link below should start you off easy.

http://hc.apache.org/httpclient-3.x/performance.html

It's your own value judgement whether or not you want to pull in another external dependency. Having migrated our applications from Tomcat, we chose to retain the dependency on HTTPClient just 'cos it's easy to use while alleviating the need to build (and maintain) another factory class.

feicipet