apache / apache/servicecomb-java-chassis

ServiceComb框架相比于SpringMvc在处理MultipartFile表单文件有什么优化

Open
#4,267 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
1.9k
Forks
814
Avg merge
8d 23h
Merged PRs (30d)
1

Description

代码本来使用了ServiceComb版本2.8.6,切换为SpringMVC 版本5.3.31后,发现有一个上传文件的接口效率下降了

业务代码如下
```java
@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的原因

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by comparing the two entry points named in the issue: Tomcat's MultipartStreamItemInputStream.findSeparator and Netty's HttpPostMultipartRequestDecoder.findMultipartDelimiter. Review the flame-graph evidence and the MultipartFile upload path to determine whether ServiceComb adds an optimization or whether the difference is attributable to the underlying servers. Done means documenting the cause and any supported optimization or configuration change.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring
Domain
api, backend, performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.