Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How should I decide the quotas for the Tridion core service binding?

Tags:

wcf

tridion

I am connecting to the Tridion core service using a System.ServiceModel.WsHttpBinding. The service will only be used by authenticated users, and probably only by code which I control. I have to choose values for the following

  • MaxBufferPoolSize (default 524,288 bytes)
  • MaxReceivedMessageSize (default 65,536 bytes)
  • ReaderQuotas.MaxArrayLength (default 16384 bytes)
  • ReaderQuotas.MaxBytesPerRead (default 4096 bytes)
  • ReaderQuotas.MaxNameTableCharCount (default 16384 bytes)
  • ReaderQuotas.MaxStringContentLength (default 8192 bytes)

The code examples I have seen for using the core service invariably set at least some of these to values larger than the defaults, for example 4Mb. Is this because of known problems when other values, such as the defaults, are used?

MaxBufferPoolSize is there to allow you to prevent excessive garbage collections. Is this simply a matter of monitoring GCs and tuning based on that?

MaxReceivedMessageSize, MaxArrayLength and MaxBytesPerRead are there to defend against Dos attacks, so in my scenario, perhaps I can improve throughput by increasing these. Would a really large number help?

MaxNameTableCharCount seems to be there to prevent uncontrolled growth of something you might not want to grow uncontrolledly, so perhaps leaving the default would be a good thing.

The documentation on MaxStringContentLength doesn't specify what happens if you exceed the quota. Presumably ReadContentAsString will fail in some way, so perhaps this value should be large.

So - should I leave these values at their defaults? Will that cause me problems? Should I increase them to large values? Will that help with throughput etc., or is it more likely to cause other problems?

like image 368
Dominic Cronin Avatar asked Apr 02 '12 20:04

Dominic Cronin


2 Answers

The general rule is to have these values as small as possible, just enough for you code to work. If you will take a look at default config that is shipped with CoreService.dll, it has some of the values increased.

For example, if you expect to get large XML lists (or search results) - you should increase MaxReceivedMessageSize. Keep in mind that you have control over the size of the list you will get using BaseColumns property of a filter.

If you prefer to use GetList, GetSystemWideList and GetSearchResults methods over their XML counterparts, you will probably have to increase ReaderQuotas.MaxArrayLength together with MaxReceivedMessageSize. But please note, that large arrays will be stored in memory.

I'm not sure you want to increase any of these values until you will hit the limit. WCF is quite good with pointing you to the parameter you have to adjust.

like image 149
Andrey Marchuk Avatar answered Nov 08 '22 11:11

Andrey Marchuk


I'm afraid this is not really an answer to your questions... But, from my experience, I increased the values to more than the defaults suggested. I used 4MB as you already suggested. This was namely because I was experiencing error while communicating with the Core Service. They were related to the request/response sizes exceeding the allotted sizes.

Moreover, in the case of Core Service transactionality, I saw more of these exceptions. It seems that the sizes of request/responses increase quite a bit when using transactions. In my case, I was creating a batch of Components in one big transaction. If one Component failed to create, I would roll-back the whole transaction.

Hope this helps.

like image 6
Mihai Cădariu Avatar answered Nov 08 '22 10:11

Mihai Cădariu