欢迎来到尧图网

客户服务 关于我们

您的位置:首页 > 科技 > IT业 > SpringBoot各类数量限制及超出后抛出的异常

SpringBoot各类数量限制及超出后抛出的异常

2025/2/7 7:31:46 来源:https://blog.csdn.net/qq_39609993/article/details/140200114  浏览:    关键词:SpringBoot各类数量限制及超出后抛出的异常

前言

在使用SpringBoot开发接口时,动不动的就发生各种超过默认值的限制,这里总结了下SpringBoot默认限制的设置以及可能会发生的异常,便于问题的排查和快速修改默认值。

配置项配置项说明默认值超过大小后抛出的异常
spring.servlet.multipart.max-file-sizeMax file size
单个上传文件大小
1MBorg.springframework.web.multipart
 MaxUploadSizeExceededException
org.apache.tomcat.util.http.fileupload.impl
 FileSizeLimitExceededException
spring.servlet.multipart.max-request-sizeMax request size.
总上传文件大小
10MBorg.springframework.web.multipart
 MaxUploadSizeExceededException
org.apache.tomcat.util.http.fileupload.impl
 SizeLimitExceededException
server.max-http-header-sizeMaximum size of the HTTP message header8KB此值设置过大可能会造成内存溢出
server.tomcat.max-http-form-post-sizeMaximum size of the form content in any HTTP post request2MB
server.tomcat.accept-countMaximum queue length for incoming connection requests when all possible request processing threads are in use
当所有可能的请求处理线程都在使用中时,传入连接请求的最大队列长度
100
server.tomcat.max-connectionsMaximum number of connections that the server accepts and processes at any given time. Once the limit has been reached, the operating system may still accept connections based on the “acceptCount” property
服务器在任何给定时间接受和处理的最大连接数。一旦达到限制,操作系统仍然可以接受基于“acceptCount”属性的连接
8192
server.tomcat.threads.min-spareMinimum amount of worker threads
工作线程的最小数量,初始化时创建的线程数
10
server.tomcat.threads.maxMaximum amount of worker threads
工作线程的最大数量
200
server.tomcat.connection-timeoutAmount of time the connector will wait, after accepting a connection, for the request URI line to be presented
连接器在接受连接后等待显示请求 URI 行的时间
20000
server.tomcat.keep-alive-timeoutTime to wait for another HTTP request before the connection is closed. When not set the connectionTimeout is used. When set to -1 there will be no timeout
在关闭连接之前等待另一个 HTTP 请求的时间。如果未设置,则使用 connectionTimeout。设置为 -1 时不会超时
20000
server.tomcat.max-keep-alive-requestsMaximum number of HTTP requests that can be pipelined before the connection is closed. When set to 0 or 1, keep-alive and pipelining are disabled. When set to -1, an unlimited number of pipelined or keep-alive requests are allowed
在连接关闭之前可以进行流水线处理的最大HTTP请求数量。当设置为0或1时,禁用keep-alive和流水线处理。当设置为-1时,允许无限数量的流水线处理或keep-alive请求
100
server.tomcat.max-swallow-sizeMaximum amount of request body to swallow2MB
spring.datasource.hikari.maximum-pool-sizehikari线程池最大数量

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com