You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by davilovick <d....@indisys.es> on 2008/04/09 11:27:08 UTC

Servlet Concurrency problem

Hi, we are trying to develop a servlet, but ive encountered some problems
with the concurrency. 
The problem is that only 2 HttpRequest is dispatched at the same time.

the doPost body is the following:

<code>
protected void doGet(HttpServletRequest request, HttpServletResponse
response) 
{	
  System.out.println("START");
  try { Thread.sleep(5000); } catch (InterruptedException e)
{e.printStackTrace();}

  response.getWriter().write("Hello World!!");

  System.out.println("END");
}
</code>

The request is waiting for 5 seconds, and later, return "Hello World!"

In our tests, when i launch 4 request, only 2 is running at the same time,
and when the first finiched, the third request is proccesed..

¿How can I solv this problem?

PD: Sorry, im Spanish, and my English is not well.
-- 
View this message in context: http://www.nabble.com/Servlet-Concurrency-problem-tp16583003p16583003.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Servlet Concurrency problem

Posted by Mikolaj Rydzewski <mi...@ceti.pl>.
David Smith wrote:
> I'm guessing these requests are from the same browser.  The browser 
> limits the number of connections it makes to the server to 2.  If you 
> really need more, google for hacks to the browser to allow more.
Or use wget, ab, jmeter, etc.

-- 
Mikolaj Rydzewski <mi...@ceti.pl>


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Servlet Concurrency problem

Posted by davilovick <d....@indisys.es>.
This is solution of my problem, thanks =)

David Smith-2 wrote:
> 
> I'm guessing these requests are from the same browser.  The browser 
> limits the number of connections it makes to the server to 2.  If you 
> really need more, google for hacks to the browser to allow more.
> 
> --David
> 
> davilovick wrote:
>> Hi, we are trying to develop a servlet, but ive encountered some problems
>> with the concurrency. 
>> The problem is that only 2 HttpRequest is dispatched at the same time.
>>
>> the doPost body is the following:
>>
>> <code>
>> protected void doGet(HttpServletRequest request, HttpServletResponse
>> response) 
>> {	
>>   System.out.println("START");
>>   try { Thread.sleep(5000); } catch (InterruptedException e)
>> {e.printStackTrace();}
>>
>>   response.getWriter().write("Hello World!!");
>>
>>   System.out.println("END");
>> }
>> </code>
>>
>> The request is waiting for 5 seconds, and later, return "Hello World!"
>>
>> In our tests, when i launch 4 request, only 2 is running at the same
>> time,
>> and when the first finiched, the third request is proccesed..
>>
>> ¿How can I solv this problem?
>>
>> PD: Sorry, im Spanish, and my English is not well.
>>   
> 
> 
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Servlet-Concurrency-problem-tp16583003p16608784.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Servlet Concurrency problem

Posted by David Smith <dn...@cornell.edu>.
I'm guessing these requests are from the same browser.  The browser 
limits the number of connections it makes to the server to 2.  If you 
really need more, google for hacks to the browser to allow more.

--David

davilovick wrote:
> Hi, we are trying to develop a servlet, but ive encountered some problems
> with the concurrency. 
> The problem is that only 2 HttpRequest is dispatched at the same time.
>
> the doPost body is the following:
>
> <code>
> protected void doGet(HttpServletRequest request, HttpServletResponse
> response) 
> {	
>   System.out.println("START");
>   try { Thread.sleep(5000); } catch (InterruptedException e)
> {e.printStackTrace();}
>
>   response.getWriter().write("Hello World!!");
>
>   System.out.println("END");
> }
> </code>
>
> The request is waiting for 5 seconds, and later, return "Hello World!"
>
> In our tests, when i launch 4 request, only 2 is running at the same time,
> and when the first finiched, the third request is proccesed..
>
> ¿How can I solv this problem?
>
> PD: Sorry, im Spanish, and my English is not well.
>   


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org