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
Operation | OData Client | Simple.OData.Client | Custom Http Client |
---|---|---|---|
Add | 172.9 ms | 173.5 ms | 175.2 ms |
Delete | 517.4 ms | 172 ms | 171.7 ms |
Fetch | 176.2 ms | 178.6 ms | 175.4 ms |
Fetch One | 169.3 m | 173.6 ms | 170.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
OData Client Benchmark
Http Client 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.