OData / OData/AspNetCoreOData

Can OData provide an optional sync way of serialization?

Open
#883 1 comment 1 reaction 4 assignees View on GitHub

@gathogojr is already working on this.

Since Apr 6, 2023.

Dominant language
C#
Stars
505
Forks
186
PR merge metrics
No merged PRs in 30d

Description

Discussed with OData Dev, when we (M365) serialize a large dataset, ODataResourceSerializer is very slow (easily take 60+ms for few hundreds of kb at p99). We find that all the serialization methods in ODataResourceSerializer/ODataResourceSetSerializer etc. are async (ex: WriteObjectAsync). However, when the data is ready in memory and huge (in numbers, not the content itself), using async way is a waste (context switch, lots of tasks/state machines created) and is much slower than sync way. Since each async call adds some extra cost, thousands of such async calls add a lot of cost. Actually, I tried to rewrite the WriteObjectAsync to do sync write with OData lib, which is much faster than the ODataResourceSerializer (though still slower than using HttpContext.Response.WriteAsJsonAsync).

Can OData provide an option that we can choose to do sync write? It would help us save cpu/memory as well as reducing latency.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.