开发者

Requests to servlet wait in queue

开发者 https://www.devze.com 2023-03-04 23:28 出处:网络
I am developing web app build in GWT using GWT RCP. Application is designed for instant messaging which I use redis messaging for.

I am developing web app build in GWT using GWT RCP. Application is designed for instant messaging which I use redis messaging for.

When waiting in servlete on a message and I am subscribe on that channel in redise everything works as planned. Though when number of awaiting requests on server is more than 5, the 6th request doesn't start to be processed and waits in que until one of the previous requests is processed. I wasn't sure if the problem is in redis (I am using jedis library) therefore I tried to call directly sleep on currentThread but it behaved the same.

public class TestServiceImpl extends RemoteServiceServlet implements
            TestService {

    @Override   
    public void syncWait(Date time) {
        try{
            Thread.currentThread().sleep(10000l);
        }catch (Exception e) {
            getLogger().error("sleep error", e);
        }
        return ;
    }
}

It's not just about one particular servlet, when 5 requests are opened, 6th doesn't even load s开发者_StackOverflow中文版tatic content. I tried it on jety, glassfish and tomcat.

I also tried to change settings of threadpool in glassfish, maxthread-count I set up on 200 but it didn't work.

Could you please advice on how to increase the number of requests processed pers session and per server?


For this you REALLY want to use one of the servlet Comet implementations and an NIO connector. I'm not intimately familiar with Glassfish or Jetty, but on Tomcat you can use a combination of APR (see http://tomcat.apache.org/tomcat-6.0-doc/apr.html) and advanced IO (see http://tomcat.apache.org/tomcat-6.0-doc/aio.html) to do what you want.

Please note that using Tomcat's Advanced IO is more complicated (and less well documented) than the standard Servlet 2.5 api.

Resin, Tomcat 7 and Glassfish (I believe) support the Servlet 3.0 spec which also offers support for similar features: you may want to take a look at that.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号