Post

Benchmarking OData Clients in Dotnet 8

To objectively compare the performance of these OData client libraries, we conducted a benchmarking exercise involving three scenarios:

  • Simple Add Request: Involving a single entity post-operation.

  • Simple Delete Request: Involving a single entity delete operation.

  • Simple GET By Id Request: Involving a single entity read operation by id.

  • Simple GET All Request: Involving an all entities read operation.

Device Information

OS Windows 10

Intel i7-9750H, CPU 2.60 GHz, 1CPU, 12 logical and 6 physical core

.Net 8.0.101 SDK

Benchmark Results

OperationOData ClientSimple.OData.ClientCustom Http Client
Add172.9 ms173.5 ms175.2 ms
Delete517.4 ms172 ms171.7 ms
Fetch176.2 ms178.6 ms175.4 ms
Fetch One169.3 m173.6 ms170.2 ms

The results indicated that ODataClient exhibited a slight performance advantage over Simple OData Client, while custom HttpClient consistently outperformed both libraries. This difference in performance is attributed to the optimization capabilities of custom HttpClient, which allow for fine-tuning of HTTP requests and responses.

Simple OData Client Benchmark

simple-odata-benchmark

OData Client Benchmark

odata-client-benchmark

Http Client Benchmark

httpclient-benchmark

Conclusion

The choice between ODataClient, custom HttpClient, and Simple OData Client hinges on the specific requirements of the project. For straightforward OData interactions and a focus on data manipulation, ODataClient provides a balanced combination of ease of use and performance. In cases demanding granular control over HTTP communication and performance optimization, custom HttpClient emerges as the preferred choice. For beginners or those prioritizing simplicity, Simple OData Client offers a lightweight and approachable entry point into the world of OData development.

Other

  • The benchmarking code is available on GitHub
  • Tools related to OData EDMX or Metadata are available here
  • Other Related blogs
This post is licensed under CC BY 4.0 by the author.