How to use Servlet 3 @WebServlet & async with Spring MVC 3?

后端 未结 5 1495
伪装坚强ぢ
伪装坚强ぢ 2020-12-14 21:57

I would like to integrate the servlet 3.0 async support with spring MVC. Something like:

@RequestMapping(\"/chat\")
@WebServlet(name=\"myServlet\", asyncSupp         


        
5条回答
  •  被撕碎了的回忆
    2020-12-14 22:13

    Not so fast, it is not that easy to implement good long polling. The method you mentioned works well, but there is a serious issue of "thread starvation"

    Each Long polling will use up one thread, if you have 1000 concurrent user you would need 1000 thread to service the long polling request ( which most of the time does update of the server side status on the client browser)

    Jetty 6 has a continue pattern whcih cleverly releases the thread of long polling request to be used by rhe real application logic.

提交回复
热议问题