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中的模型 ...
随机推荐
- Objective-C专题,是学习iOS开发的前奏(转)
第一个OC的类 来源:http://www.cnblogs.com/mjios/archive/2013/04/06/3002814.html 本文目录 一.语法简介 二.用Xcode创建第一个OC的 ...
- Period[HDU1358]
Period Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Sub ...
- BZOJ3755 : Pty爬山
l[i],r[i]表示站在i点往左往右走能看到的最高峰,用栈维护凸壳求出 h[i]表示i点能看到的最高峰的高度 a[i],b[i]表示i点往左往右走时反悔的点,即第一个h[j]>h[i]的j,用 ...
- 移动APP 中文输入法下的搜索优化
最近做了一个移动端的搜索功能,带有suggest.实现上并没有什么可说的,但是在后续优化上,特别是在中文输入法的情况下的优化使我学到一些新东西,所以决定写一篇文章. 下面是我简化后的基本功能实现,监听 ...
- TYVJ P1002 谁拿了最多奖学金 Label:模拟 水
背景 NOIP2005复赛提高组第一题 描述 某校的惯例是在每学期的期末考试之后发放奖学金.发放的奖学金共有五种,获取的条件各自不同:1) 院士奖学金,每人8000元,期末平均成绩高于80分( ...
- [Algorithms(Princeton)] Week1 - Percolation
public class Percolation { private boolean[] openSites; private int gridN; private WeightedQuickUnio ...
- div里嵌套了img底部会有白块问题和图片一像素问题解决
div里嵌套了img底部会有白块 因为img默认是按基线(baseline)对齐的.对比一下图片和右边的p, q, y等字母,你会发现这三个字母的“小尾巴”和图片下方的空白一样高.下面这张图中的黑线就 ...
- SQL server 表中如何创建索引?
SQL server 表中如何创建索引?看个示例,你就会了 use master goif db_id(N'zhangxu')is not nulldrop database zhangxugocre ...
- 在thinkphp框架模板中引用session
我已经将模板引擎配置为smarty,在模板中使用常量是写为 {$smarty.const.ADMIN_IMG} 到使用到session的值时这样写 {$smarty.session.mg_name}
- IIS服务器下301跳转是怎么样实现的?
301跳转的用法很多,对于一名SEO来说,301转向是必须掌握的本领,但是对于301转向而言,许多人都并不清楚,301跳转以后,需不需要对原网站进行优化,再次提及一边301跳转的定义. 所谓301跳转 ...