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中的模型 ...
随机推荐
- spring实战三装配bean之Bean的作用域以及初始化和销毁Bean
1.Bean的作用域 所有的spring bean默认都是单例.当容器分配一个Bean时,不论是通过装配还是调用容器的getBean()方法,它总是返回Bean的同一个实例.有时候需要每次请求时都获得 ...
- 模拟 2013年山东省赛 J Contest Print Server
题目传送门 /* 题意:每支队伍需求打印机打印n张纸,当打印纸数累计到s时,打印机崩溃,打印出当前打印的纸数,s更新为(s*x+y)%mod 累计数清空为0,重新累计 模拟简单题:关键看懂题意 注意: ...
- 优雅绝妙的Javascript跨域问题解决方案
关于Javascript跨域问题的解决方案已在之前的一片文章中详细说明,详见:http://blog.csdn.net/sfdev/archive/2009/02/13/3887006.aspx: 除 ...
- 洛谷 P1541 乌龟棋 Label:O(n^4)的dp
题目背景 小明过生日的时候,爸爸送给他一副乌龟棋当作礼物. 题目描述 乌龟棋的棋盘是一行N个格子,每个格子上一个分数(非负整数).棋盘第1格是唯一的起点,第N格是终点,游戏要求玩家控制一个乌龟棋子从起 ...
- LeetCode-Repeated DNA Sequences (位图算法减少内存)
Repeated DNA Sequences All DNA is composed of a series of nucleotides abbreviated as A, C, G, and T, ...
- myeclipse显示行号
1.ctrl+f10,选择显示行号: 2.窗口(windows)-->首选项-->常规-->编辑器-->文本编辑器-->选择显示行号
- Apache是目前应用最广的Web服务器,PHP3是一种类似ASP的脚本语言
一.如何获得软件? 获得这3个软件包的方法很多,目前大多数Linux分发都捆绑了这3个软件包,如RedHat.本文介绍的安装方法是基于从这些软件的官方站点上下载获得的软件包进行的,针对RedHat L ...
- 【液晶模块系列基础视频】4.1.X-GUI图形界面库-画线画圆等函数简介
[液晶模块系列基础视频]4.1.X-GUI图形界面库-画线画圆等函数简介 ============================== 技术论坛:http://www.eeschool.org 博客地 ...
- 运行eclipse弹出“Failed to load the JNI shared”解决方法
听周围的人说,看网上的人说eclipse有多么神奇.我不禁好奇万分,于是自己就去eclipse官网下载一个软件.咱也来用用,满怀兴奋的心情,一运行eclipse结果 出现下图的错误提示:“Failed ...
- p2p网贷项目开发全过程技术详解,应用框架是ci2.2
p2p网贷项目开发全过程技术详解,应用框架是ci2.2 很标准的mvc开发代码,代码也很简单,方便二次开发 这篇文章会不断更新