Parallel Processing in ASP.net Framework 2.0
Hi All,
I need to do parallel processing in my coding because i have 4 sql to fetch data from database which each take me 3-4 minutes.All the tables involved are raw table and that is no way i can reduce the time for the sql.
I need to find a way out to reduce the data fetching time.The only thing i canfigure out is to have this 4 sql execute at the same time by doing parallel processing.
Hi all, do you have any idea on fasterning the process other than parallel processing?
I have find online but no sample coding for parallel processing on .net framewrok 2.0.
Could anyone please share ith me?
Re: Parallel Processing in ASP.net Framework 2.0
Try to order your 4 SQL statements by how long they run , Longest one first to shortest one last.On the First 3 SQL connection strings add ";Asynchronous Processing=true"
and call thenhem all one after the other to run Async.
Code:
Dim Callback1 As IAsyncResult
Dim Callback2 As IAsyncResult
Dim Callback3 As IAsyncResult
.........
sqlconn1.ConnectionString = ConnectSql1 & ";Asynchronous Processing=true"
sqlconn2.ConnectionString = ConnectSql2 & ";Asynchronous Processing=true"
sqlconn3.ConnectionString = ConnectSql3 & ";Asynchronous Processing=true"
sqlconn4.ConnectionString = ConnectSql4
.........
Callback1 = sqlcmd1.BeginExecuteReader()
Callback2 = sqlcmd2.BeginExecuteReader()
Callback3 = sqlcmd3.BeginExecuteReader()
SqlDr4 = sqlcmd4.ExecuteReader()
SqlDr3 = sqlcmd3.EndExecuteReader(Callback3)
SqlDr2 = sqlcmd2.EndExecuteReader(Callback2)
SqlDr1 = sqlcmd1.EndExecuteReader(Callback1)
.........