简体   繁体   English

“早期消费”是什么意思? 你的意思是memory在启动时消耗?

[英]What does “early consumption” mean? Do you mean memory consumption at startup?

Spring Boot 2.2 Release Notes · spring-projects/spring-boot Wiki Spring Boot 2.2 发行说明·spring-projects/spring-boot Wiki

The filter that handles the _method request parameter is now disabled by default as it causes early consumption of a request body if the body may contain parameters.现在默认禁用处理 _method 请求参数的过滤器,因为如果请求主体可能包含参数,它会导致请求主体的早期消耗。

What exactly does that mean "early consumption"?这究竟是什么意思“早期消费”?

What I have currently searched:我目前搜索的内容:

Spring Boot 2.2 Reaches First Milestone Release with Performance and Memory ImprovementsSpring 引导 2.2 达到第一个里程碑版本,具有性能和 Memory 改进

Excerpt:摘抄:

Startup performance is also improved by disabling other JPA scanners (eg Hibernate)通过禁用其他 JPA 扫描仪(例如休眠)也提高了启动性能

This article discusses memory improvements at startup performance.本文讨论 memory 在启动性能方面的改进。

So I guess from this, does "early consumption" mean "Memory consumption at startup"?所以我从这里猜想,“早期消费”是否意味着“启动时的内存消耗”?

Formal definition正式定义

Formally speaking "early consumption" means that the body is consumed early;) This means that the body of a request is consumed at a point of time when it is not really necessary and it is not yet clear if it will be needed at all.正式地说“早期消费”是指主体被提前消费;)这意味着请求的主体是在真正不需要的时间点被消费的,目前还不清楚是否需要它。

DispatcherServlet and HiddenHttpMethodFilter DispatcherServlet 和 HiddenHttpMethodFilter

An incoming request is accepted by the DispatcherServlet. DispatcherServlet 接受传入的请求。 The DispatcherServlet call all registered filters on the request and then tries to find the correct controller for it. DispatcherServlet 调用请求中所有已注册的过滤器,然后尝试为其找到正确的 controller。

The HiddenHttpMethodFilter converts a POST request that contains a _method field to the corresponding request type (eg _method=PUT would transform this request to a PUT request). HiddenHttpMethodFilter将包含_method字段的 POST 请求转换为相应的请求类型(例如_method=PUT会将这个请求转换为 PUT 请求)。 For that it obviously has to read the body.为此,它显然必须阅读正文。 This reading is the early consumption that is referenced in the documentation.此读数是文档中引用的早期消耗。 Afterwards it has to be consumed again to pass it to the controller handling the request.之后必须再次消耗它以将其传递给处理请求的 controller。 Thus you have an overhead that can be reduced by disabling this filter.因此,您可以通过禁用此过滤器来减少开销。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM