Reputation: 5447
I have a client application that talks to an updater service to download files. The updater service gets them from a database, then sends them to the client using WCF. At the moment, I am using WSHttpBinding so I can take advantage of the security. So the biggest file I have been downloading/sending is around 8 MB, and this works fine. I recently tried it with a file that was around 130 MB, but nothing happened on the client; the Network Usage just sat at 0%.
I assume the file is too large to transfer without streaming (maxReceivedMessageSize, etc., is equal to 209715200, so I know the settings are right for it). To fix this, I want to have the service use BasicHttpBinding so I can stream the file if it is bigger than a certain size.
My question is, at what size file should I switch over from WSHttpBinding to BasicHttpBinding and streaming? Is there some sort of standard that one should follow? Or is my logic here completely wrong anyways?
Upvotes: 3
Views: 604
Reputation: 4842
As marc_s says, it depends on your site activity and available memory.
As a personal rule, I typically start considering streaming once the average size starts to get to around 1Mb. 5Mb is my "must stream" limit.
Upvotes: 1
Reputation: 754458
There's no hard rule or formula to compute this - as per usual, it depends on your circumstances.
Consider this:
your service typically can serve multiple callers simultaneously (depending on your throttling settings) - assume 10 or 20 simultaneous callers for now
if each of these callers wants to download a file, the entire file needs to be buffered in your WCF service's memory if you're not using streaming
So if 20 callers try to download a 100 MB file each at the same time, your server side machine would have to be able to use 2 GB of RAM at once. Can your server handle that besides all its other usual processes running?
With this simple calculation, you can probably make a reasonable guesstimate as to that the size limit is in your case where switching to streaming makes sense.
Upvotes: 2