tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "许明" <hsum...@qq.com>
Subject 回复: why only 2 requests for async request can raise from a end-point?
Date Mon, 29 Jun 2015 09:37:30 GMT
Hi,


I wrote a test tool with c#, not with browser, and each request has it's own session, that
browser not support now.


And, PHP and IIS can change option to set the limitation of one end-point requests, so i can't
agree browser has this limit.


I have run tomcat in localhost, and 100 requests are allowed, it's only appear when the server
and client run on different machine.


Best Regards,
Hsuming


------------------ 原始邮件 ------------------
发件人: "Ari Luoma";<ariluoma@gmail.com>;
发送时间: 2015年6月29日(星期一) 下午5:18
收件人: "Tomcat Users List"<users@tomcat.apache.org>; 

主题: Re: why only 2 requests for async request can raise from a end-point?



Hi,

The number of concurrent connections is limited by the browser:
http://stackoverflow.com/questions/561046/how-many-concurrent-ajax-xmlhttprequest-requests-are-allowed-in-popular-browse

Best Regards,
Ari Luoma


On Mon, Jun 29, 2015 at 12:08 PM, 许明  wrote:

> Hi,
>
> I am trying to bench async servlet, tomcat7 and tomcat8, now it's seems I
> can only start 2 request from a end-point.
>
>
> I make a simple tool, start 100 request same time, each request has own
> session, and write a simple async servlet, which pasted in the bottom of
> this mail.
>
>
> It's the result:
>
>
> 06-29 16:28:52 622 INFO  (Test.java:35)- test serve 1
> 06-29 16:28:52 622 INFO  (Test.java:35)- test serve 2
> 06-29 16:29:02 633 DEBUG (Test.java:54)- timout and  print
> 06-29 16:29:02 637 DEBUG (Test.java:54)- timout and  print
> 06-29 16:29:02 642 INFO  (Test.java:35)- test serve 3
> 06-29 16:29:02 677 INFO  (Test.java:35)- test serve 4
> 06-29 16:29:12 647 DEBUG (Test.java:54)- timout and  print
> 06-29 16:29:12 650 INFO  (Test.java:35)- test serve 5
> 06-29 16:29:12 682 INFO  (Test.java:35)- test serve 6
> ....
>
>
> i have test this on tomcat7 and tomcat8 in windows and linux(ubuntu), and
> test it in browser manually.
>
>
> Best Regards
>
>
> ===================
> my Test servlet:
> ===================
>
>
> package com.botao.im;
>
>
> import java.io.IOException;
> import java.io.PrintWriter;
> import java.util.concurrent.Executors;
> import java.util.concurrent.ScheduledExecutorService;
> import java.util.concurrent.TimeUnit;
>
>
> import javax.servlet.AsyncContext;
> import javax.servlet.ServletException;
> import javax.servlet.annotation.WebServlet;
> import javax.servlet.http.HttpServlet;
> import javax.servlet.http.HttpServletRequest;
> import javax.servlet.http.HttpServletResponse;
>
>
> import org.apache.log4j.Logger;
>
>
> /**
>  * Servlet implementation class Test
>  */
> @WebServlet(asyncSupported = true, name = "test", urlPatterns = { "/test"
> })
> public class Test extends HttpServlet {
>         private static final long serialVersionUID = 1L;
>
>
>         private static Logger logger = Logger.getLogger(Test.class);
>
>         private static ScheduledExecutorService es =
> Executors.newSingleThreadScheduledExecutor();
>
>         private static int counter = 0;
>
>         protected void doGet(HttpServletRequest request, final
> HttpServletResponse response) throws ServletException, IOException {
>
>                         logger.info("test serve " + (++counter ));
>                         final AsyncContext context = request.startAsync();
>
>
>                         context.start(new Runnable() {
>
>                                 @Override
>                                 public void run() {
>                                         context.setTimeout(1000000);
>                                          es.schedule(new Runnable(){
>
>
>                                                 @Override
>                                                 public void run() {
>
> response.setContentType("text/plain");
>                                                         PrintWriter out;
>                                                         try {
>                                                                 out =
> response.getWriter();
>
> out.print("hello");
>
> out.flush();
>
> context.complete();
>
> logger.debug("timout and  print");
>                                                         } catch
> (IOException e) {
>                                                         }
>
>                                                 }
>
>                                          }, 10, TimeUnit.SECONDS);
>                                 }
>                         });
>
>         }
>
>
>
>
> }
Mime
  • Unnamed multipart/alternative (inline, 8-Bit, 0 bytes)
View raw message