.NET 4.6, using nettcpbinding, I understand that in this case binary serialization works by default. What can be configured to optimize data transfer, it is planned to load up to 1 000 000 records to the client approximately 300-600 bytes each, i.e. total traffic can be up to 600 MB hosting IIS7. Does the transfer of XML text affect, for example, the field names? How can I reduce the volume?

    1 answer 1

    For net.tcp binding, the default is Microsoft XML binary encoding. This is the same XML in its essence, only the tag names are not repeated in strings, but written once, and then only their indices. Well, a few more optimizations. But essentially, it’s still XML.

    From the built-in WCF, you can try streaming mode - so that WCF does not keep all these 1,000,000 entries in memory before sending (and in some cases after). But in this case there will be restrictions on what can be used: https://msdn.microsoft.com/en-us/library/ms733742(v=vs.110).aspx

    Does a client need all this million entries at the same time? In our project, in such cases, we either return a million "headers" (that is, very brief information about the object), or we return the first portion and the total number (and sometimes without it). And then the client requests the following "pages" (as the user scrolls the list, for example).

    • Yes, it is convenient for the client to get them right away and work with a quick search for filtering, technically locally searching for 1 million items works smartly, it remains to optimize the transfer of this data from the server. You can of course filter on the server, but still network lags can sometimes slow down. If, with traffic optimization, in order to shrink every 10 times, it will be necessary to use a filter on the server, the data will most likely be all in the cache on the server and synchronize with the DBMS. - Json76