-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RequestMapper performance issue: ToByteArray(request.Body) #1679
Comments
Hi weichao! Could you correct your English text description please? It is hard to read it! In general I understand the issue, but we need to work on description and user scenario to accept the issue. Do you have some draft solution with a fix? |
Hi I have a large number of iot,they post real time data to the platform. every time convert client request httpcontent to destination must use I found that YARP → StreamCopier.cs use |
Yes, this is a good choice! |
Ok @raman-m could you assign me? Thanks! |
You're assigned. |
* using ArrayPool<byte> instead of memorystream CopyToAsync * Maybe this could be a solution. It should be checked. Adding StreamHttpContent (yarp) * little bit of cleanup here * Avoiding ToLower() in IsSupportedHeader, using StringComparer.OrdinalIgnoreCase * for smaller payloads, avoid allocating a buffer that is larger than the announced content length * adding some unit tests for stream http content tests * typo * GivenThereIsAPossiblyBrokenServiceRunningOn * Some code refactorings after code review. There are still some todos, but providing some more improvements, removing the exception handling from RequestMapper. It's handled in the middleware now, we will need to analyze this in detail. * Some code cleanup * removing some commented code bits * adding more information in InvalidOperationException * changing some methods signatures in request mapper, making them static. * code review * Update gotchas.rst * Update notsupported.rst * Update gotchas.rst Add "Maximum request body size" notes * With this fix, the system is able to handle content with size > 2 Gb * adding new benchmarks, generating the payloads on the fly, from 1KB to 1024MB * Review PayloadBenchmarks * valid JSON * should make sure the payloads directory exists * Payloads folder name should match test method name --------- Co-authored-by: Raman Maksimchuk <dotnet044@gmail.com>
Expected Behavior / New Feature
File: RequestMapper.cs
Method: Task<HttpContent> MapContent(HttpRequest request)
Line:
There are performance issues.
Maybe Can change to use
ArrayPool
like YARP, This can reduce GCbyte[]
.The text was updated successfully, but these errors were encountered: