aspose file tools
The moose likes Sockets and Internet Protocols and the fly likes HTTPConnection pooling Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Reply Bookmark "HTTPConnection pooling" Watch "HTTPConnection pooling" New topic
Author

HTTPConnection pooling

Saha Kumar
Ranch Hand

Joined: Feb 23, 2006
Posts: 218
Hello all,

Is it a good practice to pool HTTPConnections? I want to speed up access to a server which is accessed via HTTPConnection.

Thank you.

-Saha
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 35223
    
    7
There is really no point on pooling HTTP connections. HTTP is a connection-less protocol: you connect, send a request, receive a response, and it disconnects. With HTTP 1.1. you can use keep-alive, which lets a connection live even after the response has been received, but only for a short time. And it would need to be for the same server to begin with, so: if you have a need to connect to the same server multiple times, and not for the same session/clickstream, then you should reconsider your architecture/design.


Android appsImageJ pluginsJava web charts
Saha Kumar
Ranch Hand

Joined: Feb 23, 2006
Posts: 218
Thank you Ulf. I connect to the same server. I only require stateless functionality (not necessary to keep same session). What are the other options? The protocol is https.

-Saha
R Ramesh
Greenhorn

Joined: Oct 08, 2004
Posts: 9
In continuation to the post,
Let's say if a client made a request to server, by that time if the server is responding to another request then would this request be queued by the server and respond after it completes it current service? Since the client is waiting for the response from server would there any exception thrown at the client end? If yes, what is the time limit the client could expect an exception?
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8259

Originally posted by R Ramesh:
In continuation to the post,
Let's say if a client made a request to server, by that time if the server is responding to another request then would this request be queued by the server and respond after it completes it current service?

Yes, though a well-written server will service multiple clients simultaneously.


Since the client is waiting for the response from server would there any exception thrown at the client end?

While the client is waiting? No.
If the connection times out, yes.


If yes, what is the time limit the client could expect an exception?

java.net.URLConnection and java.net.Socket have methods to get/set a timeout.


"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: HTTPConnection pooling
 
Similar Threads
how to communicate with the ASP through MIDlet
Game - Sending Scores to a web server
MSN through j2me
Is J2ME able to input data in a database?
setfollowedredirects(urgent)