当前位置: 首页 > 知识库问答 >
问题:

Spring Boot应用程序tomcat中的默认线程池

濮阳耀
2023-03-14

在Spring Boot应用程序中或一般情况下,tomcat是否配置了默认线程池?

如果配置了线程池,当容器从池中挑选线程时,特定的线程将服务于许多请求?

共有1个答案

陈扬
2023-03-14

下面是springboot中嵌入的Tomcat的配置

server.tomcat.accept-count=100 # Maximum queue length for incoming connection requests when all possible request processing threads are in use.
server.tomcat.accesslog.buffered=true # Whether to buffer output such that it is flushed only periodically.
server.tomcat.accesslog.directory=logs # Directory in which log files are created. Can be absolute or relative to the Tomcat base dir.
server.tomcat.accesslog.enabled=false # Enable access log.
server.tomcat.accesslog.file-date-format=.yyyy-MM-dd # Date format to place in the log file name.
server.tomcat.accesslog.pattern=common # Format pattern for access logs.
server.tomcat.accesslog.prefix=access_log # Log file name prefix.
server.tomcat.accesslog.rename-on-rotate=false # Whether to defer inclusion of the date stamp in the file name until rotate time.
server.tomcat.accesslog.request-attributes-enabled=false # Set request attributes for the IP address, Hostname, protocol, and port used for the request.
server.tomcat.accesslog.rotate=true # Whether to enable access log rotation.
server.tomcat.accesslog.suffix=.log # Log file name suffix.
server.tomcat.additional-tld-skip-patterns= # Comma-separated list of additional patterns that match jars to ignore for TLD scanning.
server.tomcat.background-processor-delay=10s # Delay between the invocation of backgroundProcess methods. If a duration suffix is not specified, seconds will be used.
server.tomcat.basedir= # Tomcat base directory. If not specified, a temporary directory is used.
server.tomcat.internal-proxies=10\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}|\\
        192\\.168\\.\\d{1,3}\\.\\d{1,3}|\\
        169\\.254\\.\\d{1,3}\\.\\d{1,3}|\\
        127\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}|\\
        172\\.1[6-9]{1}\\.\\d{1,3}\\.\\d{1,3}|\\
        172\\.2[0-9]{1}\\.\\d{1,3}\\.\\d{1,3}|\\
        172\\.3[0-1]{1}\\.\\d{1,3}\\.\\d{1,3}\\
        0:0:0:0:0:0:0:1\\
        ::1 # Regular expression that matches proxies that are to be trusted.
server.tomcat.max-connections=10000 # Maximum number of connections that the server accepts and processes at any given time.
server.tomcat.max-http-header-size=0 # Maximum size in bytes of the HTTP message header.
server.tomcat.max-http-post-size=2097152 # Maximum size in bytes of the HTTP post content.
server.tomcat.max-threads=200 # Maximum amount of worker threads.
server.tomcat.min-spare-threads=10 # Minimum amount of worker threads.
server.tomcat.port-header=X-Forwarded-Port # Name of the HTTP header used to override the original port value.
server.tomcat.protocol-header= # Header that holds the incoming protocol, usually named "X-Forwarded-Proto".
server.tomcat.protocol-header-https-value=https # Value of the protocol header indicating whether the incoming request uses SSL.
server.tomcat.redirect-context-root=true # Whether requests to the context root should be redirected by appending a / to the path.
server.tomcat.remote-ip-header= # Name of the HTTP header from which the remote IP is extracted. For instance, `X-FORWARDED-FOR`.
server.tomcat.resource.cache-ttl= # Time-to-live of the static resource cache.
server.tomcat.uri-encoding=UTF-8 # Character encoding to use to decode the URI.
server.tomcat.use-relative-redirects= # Whether HTTP 1.1 and later location headers generated by a call to sendRedirect will use relative or absolute redirects.

正如您在默认值中所看到的,工作线程的最小数量是10,工作线程的最大数量是200,当所有可能的请求处理线程都在使用时,传入连接请求的最大队列长度是100

 类似资料:
  • 还有,我应该什么时候关闭executor服务? 我是新的纺纱线程这种方式,有人能帮助我了解它是如何工作的吗?

  • 我的工作与Javawebapp与Apache Tomcat一起运行。Tomcat线程池的最大线程数为800,minSpareThread为25。当它运行时,它通常在给定时间运行大约400个线程。 比方说,我有一个计算成本很高的非阻塞任务,我必须在我的Tomcat应用程序中完成,在这个应用程序中,ForkJoinPool。commonPool用于更有效地解决任务。 因为我的ApacheTomcat应

  • 问题内容: Tomcat5.5上部署的Web应用程序的默认会话超时是多少?它是特定于浏览器的吗?在我的Web应用程序中,默认超时没有在代码中或代码中提及。 问题答案: 打开并找到这个 所有Web应用程序都隐式继承自此默认Web描述符。您可以覆盖session-config以及在web.xml中定义的其他设置。 这实际上来自我的Tomcat 7(Windows),但我认为5.5 conf差别不大

  • 部署在Tomcat5.5上的Web应用程序的默认会话超时是多少?它是浏览器特定的吗?在我的Web应用程序中,默认超时在和代码中都没有提到。

  • 完成干净的构建后,我将war文件复制到Tomcat的文件夹中。但是部署会发生两次,并且在上下文已经存在的情况下以异常结束。我错过了什么? 非常感谢您的帮助。

  • 问题内容: 我对Tomcat不太熟悉,在我看来,它基本上是抽象为cgi服务器,可以在两次调用之间保存JVM -尽管我知道它可以做得多。 我正在寻找一种在Tomcat服务器启动时启动 后台 线程的方法,该方法会定期更新服务器上下文(在我的特殊情况下,这是一个侦听其他服务的心跳并更新可用性信息的线程,但是可以想象得到有多种用途)。 有标准的方法吗?上下文的启动和更新/查询? 指向相关文档和/或代码示例