You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by "xxffzq (via GitHub)" <gi...@apache.org> on 2024/03/15 07:14:51 UTC
[I] ServiceComb框架相比于SpringMvc在处理MultipartFile表单文件有什么优化 [servicecomb-java-chassis]
xxffzq opened a new issue, #4267:
URL: https://github.com/apache/servicecomb-java-chassis/issues/4267
代码本来使用了ServiceComb版本2.8.6,切换为SpringMVC 版本5.3.31后,发现有一个上传文件的接口效率下降了
业务代码如下
`
@ResponseBody
@PostMapping(value = "/uploadFile", produces = MediaType.MULTIPART_FORM_DATA)
public Response upload1File(@NotNull MultipartFile file, HttpServletRequest request) {
try (InputStream inputStream = file.getInputStream();) {
// 具体业务
}
}
`
分析了火焰图,发现使用了MVC框架后,主要在这部分消耗比较多时间
[40]48.31% 9,101 self: 0.02% 3 orglapache/tomcat/util/http/fileupload/MultipartStreamSItemInputStream.makeAvailable
.. [41]30.95% 5,830 self 0.02% 3 org/apache/tomcat/util/http/fileupload/MultipartStreamSItemInputStream.findSeparator
[42]30.93% 5,827 self: 30.93% 5,827 org/apache/tomcat/util/http/fileupload/MultipartStream.findSeparator
serviceComb 处理表单的方法
io.netty.handler.codec.http.multipart.HttpPostMultipartRequestDecoder#findMultipartDelimiter
想问下ServiceComb在对于MultipartFile文件接口有没有做什么优化,还是说可能只是底层一个是tomcat,一个是netty的原因
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@servicecomb.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] ServiceComb框架相比于SpringMvc在处理MultipartFile表单文件有什么优化 [servicecomb-java-chassis]
Posted by "liubao68 (via GitHub)" <gi...@apache.org>.
liubao68 commented on issue #4267:
URL: https://github.com/apache/servicecomb-java-chassis/issues/4267#issuecomment-2268095286
java chassis的上传下载支持 `REST over servlet` 和 `Rest over vert.x`两种模式。 不同的模式相对于spring boot,都是完全重新实现的,不依赖于Spring MVC的实现。 参考: [Java Chassis与Spring Boot 集成介绍](https://servicecomb.apache.org/references/java-chassis/zh_CN/spring-boot/introduction.html)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@servicecomb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] ServiceComb框架相比于SpringMvc在处理MultipartFile表单文件有什么优化 [servicecomb-java-chassis]
Posted by "SweetWuXiaoMei (via GitHub)" <gi...@apache.org>.
SweetWuXiaoMei commented on issue #4267:
URL: https://github.com/apache/servicecomb-java-chassis/issues/4267#issuecomment-2499400442
比较高效的原因,大概是两个,1是利用vert.x分段上传,2是异步执行。代码查看:RestBodyHandler
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@servicecomb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org