Avoiding GC thrashing with WSE 3.0 MTOM service
Posted
by Leon Breedt
on Stack Overflow
See other posts from Stack Overflow
or by Leon Breedt
Published on 2010-05-20T08:22:10Z
Indexed on
2010/05/20
12:20 UTC
Read the original article
Hit count: 375
For historical reasons, I have some WSE 3.0 web services that I cannot upgrade to WCF on the server side yet (it is also a substantial amount of work to do so).
These web services are being used for file transfers from client to server, using MTOM encoding. This can also not be changed in the short term, for reasons of compatibility. Secondly, they are being called from both Java and .NET, and therefore need to be cross-platform, hence MTOM.
How it works is that an "upload" WebMethod is called by the client, sending up a chunk of data at a time, since files being transferred could potentially be gigabytes in size.
However, due to not being able to control parts of the stack before the WebMethod is invoked, I cannot control the memory usage patterns of the web service.
The problem I am running into is for file sizes from 50MB or so onwards, performance is absolutely killed because of GC, since it appears that WSE 3.0 buffers each chunk received from the client in a new byte[] array, and by the time we've done 50MB we're spending 20-30% of time doing GC.
I've played with various chunk sizes, from 16k to 2MB, with no real great difference in results.
Smaller chunks are killed by the latency involved with round-tripping, and larger chunks just postpone the slowdown until GC kicks in.
Any bright ideas on cutting down on the garbage created by WSE? Can I plug into the pipeline somehow and jury-rig something that has access to the client's request stream and streams it to the WebMethod?
I'm aware that it is possible to "stream" responses to the client using WSE (albeit very ugly), but this problem is with requests from the client.
© Stack Overflow or respective owner