C# Driver: High CPU time spent in IFindFluentExtensions.SingleOrDefaultAsync

Hi,

When performing load tests for our API calling MongoDB via (newest) .NET driver we observed high CPU spikes for e.g. 100 concurrent users.

11th Gen Intel(R) Core™ i7-11850H @ 2.50GHz 2.50 GHz

Spikes are up to 80-90%.

In Visual Studio CPU profiling lists the top congestion in

Function Name Total CPU [unit, %] Self CPU [unit, %] Module

  • [External Call]
    MongoDB.Driver.IFindFluentExtensions.SingleOrDefaultAsync<T1, T2>(MongoDB.Driver.IFindFluent<T1, T2>, System.Threading.CancellationToken) 262580 (29.37%) 262541 (29.36%) mongodb.driver

Can you explain what may be reason behind. We have experimented with limiting projection size but still CPU reaches high levels.

Is there any active waiting being performed?

Thanks!