bjornsone
asked on
Several simultaneous URLConnections to a single server
I have a java application using Sun's JDK 1.4 which opens
several URLConnections to our server. Some of these take
the server a long time to generate a response, and sometimes
the client has several that occur at the same time.
It appears that java does not allow them to all happen in parallel.
Perhaps java may be trying to reuse the same socket connection
for processing each http request in serial. With some of my slow
responses, however, this default limitation on parallel URLConnections
is really making things unacceptably slow.
Is there any way I can change the configuration so that there is
1. No small limit to the number of simultaneous connections
2. Even if some of the responses are slow, the other responses don't
have to wait.
Thanks a lot
several URLConnections to our server. Some of these take
the server a long time to generate a response, and sometimes
the client has several that occur at the same time.
It appears that java does not allow them to all happen in parallel.
Perhaps java may be trying to reuse the same socket connection
for processing each http request in serial. With some of my slow
responses, however, this default limitation on parallel URLConnections
is really making things unacceptably slow.
Is there any way I can change the configuration so that there is
1. No small limit to the number of simultaneous connections
2. Even if some of the responses are slow, the other responses don't
have to wait.
Thanks a lot
You're presumably handling them in separate threads? If not, that's what you should do
Make your URLConnection class implement Thread interface then use methods .start() to dispatch the connection code.
ASKER
Yes, I am using separate threads, but java somewhere at a lower
level has restrictions on how it handles multiple URLConnections to
the same server.
level has restrictions on how it handles multiple URLConnections to
the same server.
>>
but java somewhere at a lower
level has restrictions on how it handles multiple URLConnections to
the same server.
>>
What's your OS and how many open connections have you got?
but java somewhere at a lower
level has restrictions on how it handles multiple URLConnections to
the same server.
>>
What's your OS and how many open connections have you got?
ASKER
It runs on windows 2000 and windows xp
I can't set an absolute maximum that our application
may be using at once, but it should typically not
exceed 5.
I can't set an absolute maximum that our application
may be using at once, but it should typically not
exceed 5.
>>I can't set an absolute maximum that our application may be using at once
You certainly can set a maximum number of threads and should. 5 would be absolutely fine. You should probably set a timeout and an exception will be thrown, allowing the thread to exit
You certainly can set a maximum number of threads and should. 5 would be absolutely fine. You should probably set a timeout and an exception will be thrown, allowing the thread to exit
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Clarification:
In
HOST: <your host>\r\n
<your host> means the name of your server like www.microsoft.com
In
HOST: <your host>\r\n
<your host> means the name of your server like www.microsoft.com
ASKER
Thanks alot
8-)