2

I have a WCF service which got methods for users to upload documents into the Document Management system location after doing some other tasks.

This is widely used and atleast 1000 documents are uploaded using the above mentioned service everyday.

The method in the service accepts byte[] and off late we noticed that, the physical memory on the server is reaching upto 90% some times and CPU usage is maxing out.

Do you think it may be due to the reason why byte[] is used by the method?

How can I force Garbage Collection or free up the memory?

Please advice.

3
  • 1
    I'd first do a profiling to see where the performance bottleneck is. And then look for some solution. But since you mentioned it, what do you do with the buffer after you finish with it? Commented Jun 23, 2012 at 15:32
  • Also, are your services single-instance or instantiated per-call? It's something to be taken into consideration. Commented Jun 23, 2012 at 15:35
  • 1
    @thecoon is right- there is no way that we can make any sort of educated guess with the information that we have here. We'd need code and probably profiler output for starters. What I can tell you is that there is nothing intrinsically wrong with using byte arrays as parameters- chances are your memory usage is that high because of something else. Commented Jun 23, 2012 at 16:48

1 Answer 1

1

For file transfer, especially large files, I would recommend you use streamed transfers rather than working with a huge byte arrays.

It won't scale very well, since it forces your application to allocate all the bytes at once.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.