PHP code:

... $query = "exec DBNAME.dbo.STOREDProcedureNAME ".$params.""; $result = mssql_query( $query ); ... 

ASP.NET code:

 ... using (SqlConnection SqlCon = new SqlConnection(WebConfigAppSettings.Current.DBLink)) { using (SqlCommand SqlCmd = new SqlCommand("STOREDProcedureName, SqlCon)) { SqlCmd.CommandType = CommandType.StoredProcedure; SqlCmd.CommandTimeout = 0; SqlCon.Open(); SqlCommandBuilder.DeriveParameters(SqlCmd); SqlParameterCollection Param = SqlCmd.Parameters; ..here stored procedure parameters set ... SqlDataReader reader = SqlCmd.ExecuteReader(); grid.DataSource = reader; grid.DataBind(); } } ... 

Searches on the Internet gave the following :

ASP will probably never be as fast as PHP. It is a built-in COM-based architecture. When he accesses a database, he uses another COM object to do so. When he accesses the file system, another COM object is called. All this COM overhead adds up and slows things down. In PHP modules, everything runs in PHP's memory space. This will make it easier for you to run the code.

The following benchmark is where you can use the SQL Server 7 using the PHP MSSQL7 extension, the php ODC extension, and the following: Using a COM interface to connect it adds 80% overhead (17.28 secs) to ODBC. OLEDB is Microsoft's high speed COM technology for accessing databases. It is faster than ODBC, but we can use the PHP MSSQL extension we get a 200% increase in performance. So just tell a ASP programmer: No COM more speed.

The essence of the problem is the following: one and the same stored procedure runs for the same length when it is called from both the SCUL studio and from an application on ASP.NET.
And when you call it from PHP, the time to get results is reduced by 2-2.5 times.

The procedure is time consuming. All that you can already optimized.
Runtime - 40-45 seconds from the studio and ASP.NET applications and 15-20 seconds when calling from php.

Has anyone had experience getting the same speed of sql queries in ASP.NET as in PHP?

  • Where is the quote from ASP? - Grundy
  • Link - Ultimat
  • one
    @Ultimat, do you feel embarrassed that the quote refers to the year 2000, when did the release of ASP.NET take place in 2002? And yes, this article is about ASP as Active Server Pages , which were written using JS or VB, which just constantly pulled COM objects through ActiveX. - Alex Krass
  • I understand this perfectly, but unfortunately, this is the only information that I managed to find about such strange plugging with performance. And, interestingly, my situation with 100% accuracy coincides with that described. On php I get a performance boost of 2-2.5 times. - Ultimat
  • @Ultimat, it all depends on the specific code. Without it, absolutely nothing can be said. We need to measure what exactly time is spent on - Grundy

0