Memory Impact of Quotas
Will setting the receive quotas to large values cause my service to run out of memory?
It depends on the messages that people send you.
Assigning large values to quotas does not cause WCF to immediately allocate the amount of memory that you specify as the quota value. Therefore, you can change the quota values and not have any problems starting up your service or receiving the same messages that you could receive before. However, if someone decides to send you a really big message, then that message will be processed up to the quota size that you specified. If both the quota value and the message size are large enough, then your service may possibly run out of memory trying to process the message.
The quota value is supposed to be the maximum amount that you think that you can afford. If the quota value is larger than the amount that will break your service, then having such a large quota value does not provide protection against messages within that size range.
Comments
Anonymous
March 03, 2009
Thank you, that was really helpful. Do you think it is a good idea to set the client's thresholds to maximum values when we can trust the server (that uses reasonable thresholds)? Bye, MarcAnonymous
March 06, 2009
Hi Marc, Quotas are primarily useful for security boundaries and only secondarily useful for catching programming bugs. If you have trust between a client and server, and no way for others to interject messages, then you may not need the security boundary and can set the quotas to quite large values. This is typically done for trusted intranet configurations.