SoapCore icon indicating copy to clipboard operation
SoapCore copied to clipboard

performance issue as well while reading the body for the soap request, i got the memory dump, and this is the img

Open akshaybheda opened this issue 1 year ago • 16 comments

some performance issue as well while reading the body for the soap request, i got the memory dump, and this is the img image

Originally posted by @akshaybheda in https://github.com/DigDes/SoapCore/issues/1021#issuecomment-1964225916

akshaybheda avatar Feb 26 '24 17:02 akshaybheda

Hmm... If the problem truly lies in ReadMessageAsync you could try to asynchronously copy the content of stream to a memorystream up top and use that instead. That will result in more memory usage but might be a worthwhile change anyway.

andersjonsson avatar Feb 27 '24 08:02 andersjonsson

you mean like the PR i created?

akshaybheda avatar Feb 27 '24 14:02 akshaybheda

you mean like the PR i created?

Yes. Can you test your service with the new code and see if that helped with your performance issues?

andersjonsson avatar Feb 27 '24 18:02 andersjonsson

So, i tested the service locally by referencing through the project, but the real performance i can only test once i have that build on a web app and run load test against it from different regions.

What i noticed when i ran locally is the cpu percentage was lower compared to current version. I can only tell about if this worked is once i deploy it in production, but anyways this is better since it is async, and does not block threads

akshaybheda avatar Feb 27 '24 18:02 akshaybheda

Also meaning to ask, is there any thing that logs request body only if its bad request or something?

akshaybheda avatar Feb 27 '24 18:02 akshaybheda

Also meaning to ask, is there any thing that logs request body only if its bad request or something?

Nope. It's certainly possible to do that in a middleware or an ISoapMessageProcessor but there is nothing built in

andersjonsson avatar Feb 28 '24 14:02 andersjonsson

Is there any config to get Content-Length header for net6 application? I always get the Transfer-Encoding but no content length header, in the soapcore lib, in WriteMessageAsync i am able to see that its setting contentLength header, but in my response i dont get that

akshaybheda avatar Feb 28 '24 15:02 akshaybheda

In asp.net core it's left out by design for performance reasons but it is set in WriteMessageAsync, as you've noted. I have never checked for it myself, so I don't know if there is a bug in SoapCore or if you're running into another issue

andersjonsson avatar Feb 28 '24 15:02 andersjonsson

A new nuget package is on its way now

andersjonsson avatar Feb 28 '24 16:02 andersjonsson

@andersjonsson merge failed due to csproj version needs to be updated

akshaybheda avatar Feb 28 '24 16:02 akshaybheda

https://github.com/DigDes/SoapCore/pull/1028

akshaybheda avatar Feb 28 '24 16:02 akshaybheda

I’ll try to get this sorted later tonight

andersjonsson avatar Feb 28 '24 16:02 andersjonsson

appreciate it

akshaybheda avatar Feb 28 '24 16:02 akshaybheda

The new nuget package should be available now

andersjonsson avatar Feb 28 '24 17:02 andersjonsson

I was able to do a deployment to prod and the results were good, only thing thats being a problem is bunch of Microsoft.AspNetCore.Connections.ConnectionResetException showing up.

I think thats the same issue as this https://github.com/dotnet/aspnetcore/issues/45086 . Anything we could do to suppress these? I believe these were 400 bad requests earlier

akshaybheda avatar Mar 04 '24 15:03 akshaybheda

@andersjonsson Microsoft hasn't made any progress about the noise generated by ComExceptions, with that being said, in the middleware, we are logging the errors and that is adding noise to the actual issues if any, you think we should supress the comexceptions as 400 till msft makes any progress

akshaybheda avatar Mar 04 '24 16:03 akshaybheda

image

These are only for few hours but with lot of traffic, this is generating noise for logs.

akshaybheda avatar Mar 05 '24 01:03 akshaybheda

https://github.com/DigDes/SoapCore/pull/1035

akshaybheda avatar Mar 05 '24 17:03 akshaybheda

I deployed it in prod and it works great. Thanks for all the help

akshaybheda avatar Mar 26 '24 19:03 akshaybheda