Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Will the maximum limit of configuration property MaxReceivedMessageSize in wcf affects service performance?

Tags:

wcf

I'm getting the following communication exception for my wcf service making cal to another wcf service: "The maximum message size quota for incoming messages (65536) has been exceeded. To increase the quota, use the MaxReceivedMessageSize property on the appropriate binding element."

I resolved this by increasing the size as below: maxReceivedMessageSize="50000000"

But, here I want to know whether any side effects of increasing message size to such big level.

like image 299
sandeep talabathula Avatar asked Feb 25 '10 09:02

sandeep talabathula


1 Answers

Yes - it might. The reason WCF keeps this limit low (64K) by default is this: imagine your server is busy responding to requests, say dozens or hundreds, and they all require the maximum message size.

Potentially, your server could have to allocate dozens or hundreds of message buffers at the same time - if you have 100 users and each requests 64K, that's 6.4 MByte - but if you have 200 users and each requests 5 MB - that's a gigabyte of RAM in the server - just for the message buffers, for one service.

So yes - putting a limit on the max message size does make sense and it helps manage your server's memory consumption (and thus performance). If you open it up too wide, an attacker might just do such an attack - flooding your server with bogus requests, each allocating as much memory as they can get, ultimately bringing your server down (Denial of Service attacks like that are quite common).

like image 100
marc_s Avatar answered Nov 13 '22 02:11

marc_s