gpt4 book ai didi

java - 基本tomcat网站: threads or processes?

转载 作者:行者123 更新时间:2023-11-28 22:06:45 24 4
gpt4 key购买 nike

对于有经验的人来说,这可能是一个非常基本和简单的问题,但我对此有点困惑:

如果有多个连接到tomcat上托管的网站,是否会有多个线程或进程或访问底层java、jsp代码的基 native 制是什么?

最佳答案

Tomcat 使用线程。有一个 article on java.net其中包括最重要的配置值:

maxThreads: Tomcat uses a thread pool, and each request will be servedby any idle thread in the thread pool. maxThreads decides the maximumnumber of threads that Tomcat can create to service requests.

minSpareThreads: When Tomcat is initially started, it may not createmaxThreads number of threads configured. Instead, it will createminSpareThreads and later, on an as-needed basis, it will create morethreads until the number of threads reaches a maximum of maxThreads.

maxSpareThreads: During off-load times, Tomcat doesn't require many ofthe threads in the pool. maxSpareThreads is the maximum number of idlethreads Tomcat will retain in the pool. If this number is exceeded,excess threads are de-referenced to allow garbage collection.

我建议您查看这篇文章。

关于java - 基本tomcat网站: threads or processes?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13448851/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com