198

Recently I used dot Trace profiler to find the bottlenecks in my application.

Suddenly, I have seen that in most of the places which are taking more time and more CPU usage to is SNINativeMethodWrapper.SNIReadSyncOverAsync() which is called by Execute reader method of ADO.Net, I don't know why it's taking more time.

If I run the same query in SQL server it's running very fast.

  1. Does anybody know why it's taking more time?
  2. What is the alternative for this ADO.Net method?
Arda Kandemir
  • 49
  • 1
  • 1
  • 7
Gobi
  • 2,041
  • 1
  • 12
  • 10
  • 11
    See this questrion's answser... http://stackoverflow.com/questions/12654002/snireadsyncoverasync-and-waitforsingleobject-blocking-ef-performance – Carl Prothman May 20 '15 at 06:26
  • 30
    This method is simply the lowest managed portion of network communication with SQL Server. Below that, it's all unmanaged. There is no alternative if you're using ADO.NET with SQL server. In general, it means your spend too much time comunicating with the network (bad sql code, slow server, network issue, named pipe vs tcpip, pooling, connection string, transactions, etc.). You can add traces to help diagnose: https://social.msdn.microsoft.com/Forums/sqlserver/en-US/38028b0f-8820-4deb-b957-9d90314406f5 – Simon Mourier Jan 18 '17 at 07:03
  • 1
    Add your sample here. So, we can find out actual problem. – Vikram Jain Jan 19 '17 at 05:16
  • 11
    Have you looked at this questions answer? http://stackoverflow.com/questions/14993309/what-is-snireadsyncoverasync-and-why-would-it-take-a-long-time-to-complete – Kevin Cook Jan 19 '17 at 17:02
  • 1
    @Gobinath_DotNetDeveloper, when you mention the same query in SQL Server is fast, do you mean when run locally on the server or remotely via SSMS? SSMS also uses ADO.NET so you should see the same low-level query execution time and CPU as you get from the application. – Dan Guzman Jan 22 '17 at 14:12
  • 1
    Try running SQL Profiler, look at the queries being executed against the database when this method run and it will tell you what is going on and how long each is taking – zaid safadi Jan 23 '17 at 21:28
  • 13
    look at #2 [here](https://blog.appdynamics.com/engineering/5-net-performance-issues-where-dev-and-ops-play-the-blame-game/) probably data volume is the cause. – Chandan Rai Jan 24 '17 at 04:46
  • 2
    Probably you should check you connection configuration. Type of lock etc – srp Mar 30 '18 at 05:33
  • 2
    Yes, if you provide more detail I think somebody will be able to help you. Please, give us details about how much CPU, READS & WRITES are shown in the SQL Profiler when running the query from the application or from the SSMS. Also, please, provide the query having problems. – Angel M. Jan 05 '19 at 17:58
  • 3
    please provide a piece of your code which does a database call and your query. is it running plain text or stored procedure? check for parameter sniffing in case of stored procedure, that is one candidate for SPs running super slow. just guessing, without code and query nothing can be said for sure. – Siavash Rostami Jan 14 '19 at 14:28
  • 2
    Could you ensure (using SQL Profiler) that SSMS and your application send the same SQL to server and use the same client library to communicate? – serge Feb 21 '19 at 16:26
  • 11
    Does this answer your question? [SNIReadSyncOverAsync and WaitForSingleObject blocking EF performance?](https://stackoverflow.com/questions/12654002/snireadsyncoverasync-and-waitforsingleobject-blocking-ef-performance) – Ivan Dec 01 '20 at 02:06
  • 2
    Does this answer your question? [What is SNIReadSyncOverAsync and why would it take a long time to complete?](https://stackoverflow.com/questions/14993309/what-is-snireadsyncoverasync-and-why-would-it-take-a-long-time-to-complete) – Toni Feb 05 '21 at 15:08
  • 1
    So is this a duplicate or has nobody just written an answer? I've seen this on my homepage for god knows how long. – Ermiya Eskandary Dec 09 '21 at 20:12

0 Answers0