异步 Servlet 与同步 Servlet [英] Asynchronous Servlets vs. synchronous Servlets

查看:26
本文介绍了异步 Servlet 与同步 Servlet的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于 Servlet 3.0 异步处理支持的.总是使用异步处理会更好吗?或者在什么情况下同步处理更好?

Since Servlet 3.0 asynchronous processing is supported. Would it be better, to use always asynchronous processing? Or in what cases is synchronous processing better?

推荐答案

异步 ​​servlet 最大的好处是 HTTP 推送,服务器可以在它选择时将信息返回给客户端,而不是在客户端请求它时.预异步 servlet,这将需要长时间运行的 HTTP 连接,每个连接都绑定一个服务器线程,这是非常低效的.这种新模型将服务器端处理与连接处理分离.

The big thing you get with asynchronous servlets is HTTP push, where the server can fire information back to the client when it chooses to, rather than when the client asks for it. Pre-asynch servlets, this would require long-running HTTP connections which each tied up a server thread, which is very inefficient. This new model decouples the server-side processing from the connection handling.

这篇关于异步 Servlet 与同步 Servlet的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆