Java web container use HTTPServlet to serve HTTP request. There are 3 ways to
handle requests:
- Create 1 thread which is used to serve all the HTTP requests. It obvious that
this approach does not scale. It can leverage OS concurrency capability and
multiple CPUs.
- Create 1 thread for every request. If there are too many concurrent requests,
too many threads will be created. With too many threads, a lot of resources
will be spent on context switches.
- Create a pool with a fixed number of threads. This approach can show a
graceful degradation under very heavy loads.
Almost non-trivial web containers use the 3rd approach. I want to make sure that
this assumption is right. So I made some experiments with Tomcat 6. The
experiments results validate the assumption. The toString method of thread to
execute HTTPServlet in Tomcat is like Thread[http-8080-2,5,main]. 8080 is port
number of Tomcat. 2 means HTTP thread ID. It is possible that 5 mains the size
of thread pool.
And it does not hold that a thread is always to serve the requests for the
session. A thread is often used to serve requests from multiple sessions.
分享到:
相关推荐
An Introduction to Programming with C# Threads
Introduction to Java Threads by Brian Goetz
Multithreading Applications in Win32 The Complete Guide to Threads - 侯捷 扫描 2002
In shared memory multiprocessor architectures, such as SMPs, threads can be used to implement parallelism. Historically, hardware vendors have implemented their own proprietary versions of threads, ...
赠送jar包:jboss-threads-3.1.0.Final.jar; 赠送原API文档:jboss-threads-3.1.0.Final-javadoc.jar; 赠送源代码:jboss-threads-3.1.0.Final-sources.jar; 赠送Maven依赖信息文件:jboss-threads-3.1.0.Final....
Operating systems can’t increase the efficiency of platform threads, but the JDK will make better use of them by severing the one-to-one relationship between its threads and OS threads.
an Introduction to programming in threads
This concise book empowers all Java developers to master the complexity of the Java thread APIs and concurrency utilities. This knowledge aids the Java developer in writing correct and complex ...
个人将网上资源进行了一些总结,是英文版的 <br>如果英文不好千万不要下,不过里面的英文都是比较初级的专业英语。
C语言编写linux线程代码。包括threads,monitor,locks,semaphone,TCB等。
Programming with POSIX Threads
This book is intended for programmers of all levels who need to learn to use threads within Java programs. This includes developers who have previously used Java and written threaded programs; J2SE ...
螺纹查询软件threads汉化版 螺纹查询软件threads汉化版
POSIX Threads Programming.pdf
赠送jar包:jboss-threads-3.1.0.Final.jar; 赠送原API文档:jboss-threads-3.1.0.Final-javadoc.jar; 赠送源代码:jboss-threads-3.1.0.Final-sources.jar; 赠送Maven依赖信息文件:jboss-threads-3.1.0.Final....
Programming with POSIX Threads 英文版+ 中文版+源码
Java.Threads.3rd.Edition.txtJava.Threads.3Java.Threads.3rd.Edition.txtrd.Edition.txtJava.Threads.3rd.Edition.txt
Programming with POSIX Threads 的源码,结合着书看,很好的。
学习 Ruby Thread 开发技术,深度解析
Java Threads Third Edition.chm