When customers create a client using DataServiceContext (without using ODataConnectedService or OData CLI), they usually experience high latencies and CPU usage hikes. This is because, by default, OData Client will fetch the $metadata endpoint and parse the csdl to get the IEdmModel on each request. The solution to this problem is to provide a customer IEdmModel loader delegate. This delegate will be called by OData Client on each request, overriding the default behaviour. To make this call efficient, the customer loader should cache the model to avoid parsing or building the model on each request. This guideline is actually already documented in our guides, but the performance impact is not emphasized, and it's a detail that's easy to miss.
I suggest we add a new section to the performance guidelines documentation that talks about this problem and the solution.
When customers create a client using
DataServiceContext
(without using ODataConnectedService or OData CLI), they usually experience high latencies and CPU usage hikes. This is because, by default, OData Client will fetch the$metadata
endpoint and parse the csdl to get theIEdmModel
on each request. The solution to this problem is to provide a customerIEdmModel
loader delegate. This delegate will be called by OData Client on each request, overriding the default behaviour. To make this call efficient, the customer loader should cache the model to avoid parsing or building the model on each request. This guideline is actually already documented in our guides, but the performance impact is not emphasized, and it's a detail that's easy to miss.I suggest we add a new section to the performance guidelines documentation that talks about this problem and the solution.
Sample customer issue: https://github.com/OData/odata.net/issues/3015