SNIReadSyncOverAsync and WaitForSingleObject blocking EF performance?

I am doing some profiling on a WCF service that uses EF (System.Data.Entities) to read from a SQL DB. When I spin up multiple parallel clients that hit the service, the CPUs all go to 100%, performance generally tanks, and everything bogs down.

In profiling this with the concurrency profiler, I found 85% of the time is spent in synchronization, with only about 4% being actual code execution. Looking deeper into the stack trace, most of the synchronization seems to be from a call to WaitForSingleObject in System.Data.SqlClient.TdsParserStateObject.ReadSniSyncOverAsync. The stack shows that the call goes to a native method wrapper and then winds up at kernel32.dll!_WaitForSingleObject.

Has anyone experienced this before? Is there any way to do something about this? I’m not really throwing absurd load at this, only about 20 parallel clients, and it’s all read-only, so I’m surprised the threads would even bother to synchronize.

I’ve been fighting with this for a week now and I just can’t explain it. Any help would be appreciated!

1 Answer
1

Leave a Comment