Servlet Threading Model
Servlet Threading Model
The scalability issues of Java servlets are caused mainly by the server threading model:
Thread per connection
The traditional IO model of Java associated a thread with every TCP/IP connection. If you have a few very active threads, this model
can scale to a very high number of requests per second.
However, the traffic profile typical of many web applications is many persistent HTTP connections that are mostly idle while users read
pages or search for the next link to click. With such profiles, the thread-per-connection model can have problems scaling to the
thousands of threads required to support thousands of users on large scale deployments.
Thread per request
The Java NIO libraries support asynchronous IO, so that threads no longer need to be allocated to every connection. When the connection
is idle (between requests), then the connection is added to an NIO select set, which allows one thread to scan many connections for activity.
Only when IO is detected on a connection is a thread allocated to it. However, the servlet 2.5 API model still requires a thread to be
allocated for the duration of the request handling.
This thread-per-request model allows much greater scaling of connections (users) at the expense of a small reduction to maximum requests
per second due to extra scheduling latency.
Asynchronous Request handling
The Jetty Continuation (and the servlet 3.0 asynchronous) API introduce a change in the servlet API that allows a request to be dispatched
multiple times to a servlet. If the servlet does not have the resources required on a dispatch, then the request is suspended (or put into
asynchronous mode), so that the servlet may return from the dispatch without a response being sent. When the waited-for resources
become available, the request is re-dispatched to the servlet, with a new thread, and a response is generated.
Servlet Threading Model的更多相关文章
- Memcached source code analysis (threading model)--reference
Look under the start memcahced threading process memcached multi-threaded mainly by instantiating mu ...
- threading模块
threading — Higher-level threading interface¶ Source code: Lib/threading.py This module constructs h ...
- python学习笔记——线程threading (一)
1 线程threading 1.1 基本概述 也被称为轻量级的进程. 线程是计算机多任务编程的一种方式,可以使用计算机的多核资源. 线程死应用程序中工作的最小单元 1.2 线程特点 (1)进程的创建开 ...
- Servlet 介绍
JSP 的本质就是 Servlet,开发者把编写好的 JSP 页面部署在 Web 容器中后,Web 容器会将 JSP 编译成对应的 Servlet. Servlet 的开发 Servlet 是个特殊的 ...
- Threading in C# 5
Part 5: Parallel Programming In this section, we cover the multithreading APIs new to Framework 4.0 ...
- Java Web基础 --- Servlet 综述(理论篇)
摘要: Web 技术成为当今主流的互联网 Web 应用技术之一,而 Servlet 是 Java Web 技术的核心基础.本文首先从请求/响应架构应用的大背景谈起 Servlet 的由来,明确 Ser ...
- Deployment options
Play applications can be deployed virtually anywhere: inside Servlet containers, as standalone serve ...
- Java性能提示(全)
http://www.onjava.com/pub/a/onjava/2001/05/30/optimization.htmlComparing the performance of LinkedLi ...
- Java---SSH(MVC)面试题
1. 谈谈你mvc的理解 MVC是Model-View-Controler的简称.即模型-视图-控制器.MVC是一种设计模式,它强制性的把应用程序的输入.处理和输出分开. MVC中的模型 ...
随机推荐
- 原生JS代码实现一个Ajax异步请求
异步加载的方式 (1) defer,只支持IE (2) async: (3) 创建script,插入到DOM中,加载完毕后callBack 实现ajax之前必须要创建一个 XMLHttpRequest ...
- Redis 连接池的问题
目录 Redis 连接池的问题 1 1. 前言 1 2.解决方法 1 前言 问题描述:Redis跑了一段时间之后,出现了以下异常. Redis Timeout ex ...
- eclipse 新建 java 文件时自动生成注释
http://blog.csdn.net/kimsoft/article/details/5337910 Windows->Preference->Java->Code Style- ...
- JS正则表达式验证数字(很全)
1.<script type="text/javascript"> 2. function validate(){ 3. var reg = new ...
- #undef
#undef 是在后面取消以前定义的宏定义 该指令的形式为 #undef 标识符 其中,标识符是一个宏名称.如果标识符当前没有被定义成一个宏名称,那么就会忽略该指令. 一旦定义预处理器标识符,它将保持 ...
- hdu1028 Ignatius and the Princess III
这是道典型的母函数的题目,可以看看我的母函数这一标签上的另一道例题,里面对母函数做了较为详细的总结.这题仅贴上代码: #include"iostream" using namesp ...
- lucene 建立索引的不同方式
1.创建一个简单的索引: package lia.meetlucene; import java.io.File; import org.apache.lucene.document.Document ...
- 一些Office 365的问题收集
1. 按照MS的最佳实践, 应该是先有本地域, 然后再有Office 365. 但是我们公司刚好相反, 于是按照前面的文章做完了硬关联, 但是现在发现对于那些原本就在Office 365上的用户的Pr ...
- json格式转换成Map的应用
jsp 1.引用json.js(将json格式转换成字符串) 2. var name = document.getElementById("name").value; var re ...
- 洛谷OJ P1196 银河英雄传说(带权并查集)
题目描述 公元五八○一年,地球居民迁移至金牛座α第二行星,在那里发表银河联邦 创立宣言,同年改元为宇宙历元年,并开始向银河系深处拓展. 宇宙历七九九年,银河系的两大军事集团在巴米利恩星域爆发战争.泰山 ...