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

news/2024/7/8 7:55:13 标签: spring boot, 后端, java

前言

在使用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线程池最大数量

http://www.niftyadmin.cn/n/5536754.html

相关文章

基流科技:超算界的新星,Pre-A轮融资大获成功

基流科技:超算界的新星,Pre-A轮融资大获成功! 在科技的浪潮中,一颗新星正在冉冉升起——基流科技,一家开放算力网络提供商,以其革命性的技术在超算界引起了轰动。今年年初,基流科技完成了 Pre-A 轮融资,由光速光合领投,此前已获得奇绩创坛、微梦传媒等知名投资方的青…

Node.js的应用场景

Node.js具有广泛的应用场景,其基于Chrome V8引擎的JavaScript运行环境使得JavaScript能够运行在服务器端,极大地扩展了其应用范围。以下是Node.js的主要应用场景: 1. 服务器端开发 Web服务器和API服务器:Node.js非常适合构建服务…

邦芒贴士:谨防12种职场不良心态影响你的晋升

​​风云变幻的职场里,一言一行都必须留意。日前,小邦总结出容易影响职位晋升的12种不良心态,帮大家扬长避短。 1.觉得自己不够好。有的人虽聪明勤快,可一旦委以重任,却总是担心自己不能胜任,变得畏首畏尾。…

go语言day08 泛型 自定义错误处理 go关键字:协程

泛型: 抛错误异常 实现error接口类型 用java语言解释的话,实现类需要重写error类型的抽象方法Error().这样就可以自定义异常处理。 回到go语言,在Error()方法中用*argError 这样一个指针类来充当error接口的实现类。 在f2()方法中定义返回值…

Qt中udp指令,大小端,帧头帧尾实际示例

前言 虽然QT中,udp发送和接收,其实非常简单,但是实际工作中,其实涉及到帧头帧尾,字节对齐,以及大小端序的问题。比如网络中,正规的一般都是大端序,而不是小端序,大多数的…

密码学:对称加密算法、非对称加密算法、哈希算法

「作者简介」:冬奥会网络安全中国代表队,CSDN Top100,就职奇安信多年,以实战工作为基础著作 《网络安全自学教程》,适合基础薄弱的同学系统化的学习网络安全,用最短的时间掌握最核心的技术。 这一章节我们需要知道密码算法分哪几类,对称算法、非对称算法、哈希算法分别有…

【前端CSS3】CSS显示模式(黑马程序员)

文章目录 一、前言🚀🚀🚀二、CSS元素显示模式:☀️☀️☀️2.1 什么是元素显示模式2.2 块元素2.3 行内元素2.4 行块元素2.5 元素显示模式的转换 三、总结🚀🚀🚀 一、前言🚀&#x1f…

NLP入门——前馈词袋分类模型的搭建、训练与预测

模型的搭建 线性层 >>> import torch >>> from torch import nn >>> class DBG(nn.Module): ... def forward(self,x): ... print(x.size()) ... return x ... >>> tmod nn.Sequential(nn.Linear(3,4),DB…