Scnario : Download 1000 PDF from report server.
PDF Size : varies from 30KB to 250KB
Business Requirement: Shall be completed in one hour
Infrastructure Setup: report server and the sql Job that downloads the files and store everything are in SAME server.
Current Code"
Dim httpConn As ConnectionManager = Dts.Connections("ReportServer " & strServer)
Dim clientConn As HttpClientConnection = New HttpClientConnection(httpConn.AcquireConnection(Nothing))
Dim docItemID As String = CType(Dts.Variables("User::DocItemID").Value, String)
Dim ReportFileName As String = CType(Dts.Variables("User::FolderLocation").Value, String) & docItemID
Dim TransportFee As Decimal = CType(Dts.Variables("User::TransportFee").Value, Decimal)
clientConn.ServerURL = "http://XXXX" & strServer & "/ReportServer?/XXXX-Reports/" & strString & "&docItemId=" & docItemID & "&type=3&rs:Command=Render&rs:Format=PDF&rc:Toolbar=False"
clientConn.DownloadFile(ReportFileName & ".pdf", True)
Problem: Even if server CPU usage is not much that means server is not busy, still in one hour only 300 files are getting downloaded.
Can you please suggest what other options we have to handle this situation? Now can we download 1000 pdf in one hour.
Shall we increase the CPU core or do you think any other class can give better performance than HttpClientConnection.
Thanks in advance
Joydeep Sen
Dont forget to click “Mark as Answer” on the post that helped you.This credits that member, earns you a point and mark your thread as Resolved for the sake of Future Readers
I find one code in C#. I can see that you are using VB.Net.
so I convert that code to VB.Net using code convertor.
Dim _downloadUrls As Queue(Of String) = New Queue(Of String)
Private Sub downloadFile(ByVal urls As IEnumerable(Of String))
For Each url In urls
_downloadUrls.Enqueue(url)
Next
' Starts the download
btnGetDownload.Text = "Downloading..."
btnGetDownload.Enabled = false
progressBar1.Visible = true
lblFileName.Visible = true
DownloadFile
End Sub
Private Sub DownloadFile()
If _downloadUrls.Any Then
Dim client As WebClient = New WebClient
client.DownloadProgressChanged = (client.DownloadProgressChanged + client_DownloadProgressChanged)
client.DownloadFileCompleted = (client.DownloadFileCompleted + client_DownloadFileCompleted)
Dim url = _downloadUrls.Dequeue
Dim FileName As String = url.Substring((url.LastIndexOf("/") + 1), (url.Length _
- (url.LastIndexOf("/") - 1)))
client.DownloadFileAsync(New Uri(url), ("C:\Test4\" + FileName))
lblFileName.Text = url
Return
End If
' End of the download
btnGetDownload.Text = "Download Complete"
End Sub
Private Sub client_DownloadFileCompleted(ByVal sender As Object, ByVal e As AsyncCompletedEventArgs)
If (Not (e.Error) Is Nothing) Then
' handle error scenario
Throw e.Error
End If
If e.Cancelled Then
' handle cancelled scenario
End If
DownloadFile
End Sub
Private Sub client_DownloadProgressChanged(ByVal sender As Object, ByVal e As DownloadProgressChangedEventArgs)
Dim bytesIn As Double = Double.Parse(e.BytesReceived.ToString)
Dim totalBytes As Double = Double.Parse(e.TotalBytesToReceive.ToString)
Dim percentage As Double = (bytesIn _
/ (totalBytes * 100))
progressBar1.Value = Integer.Parse(Math.Truncate(percentage).ToString)
End Sub
below is a links for the original code that you can try to refer to get more information.
it can download multiple files simultaneously which can help you to increase performance.
the above code is just an example, you need to modify it as per your requirement.
Regards
Deepak
MSDN Community Support
Please remember to click "Mark as Answer" the responses that resolved your issue.
If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.
thanks for the reply. The whole process happens through a sql agent job which intern calls a SSIS/DTSX package. There is a Foreach ADO Enumerator in the SSIS package. In each iteration, a documentId is passed to the report server
and downloads one pdf at a time. each call looks like
So parallel downloading might not be possible in our case.
Joydeep Sen
Dont forget to click “Mark as Answer” on the post that helped you.This credits that member, earns you a point and mark your thread as Resolved for the sake of Future Readers
you had mentioned that,"So parallel downloading might not be possible in our case."
then it will be tough to achieve your requirement with in 1 hour of time.
you can think that if you just download a single file at a time then performance will be drop and will take much more time to finish this job.
so you can try to think redesign the whole process if possible and necessary for you to get the better performance.
Regards
Deepak
MSDN Community Support
Please remember to click "Mark as Answer" the responses that resolved your issue.
If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.
Contributor
2775 Points
783 Posts
Download PDF from SSRS using HttpClientConnection performance ISSUE
Sep 21, 2017 08:50 AM|joydeepsen|LINK
Dear Team
Scnario : Download 1000 PDF from report server.
PDF Size : varies from 30KB to 250KB
Business Requirement: Shall be completed in one hour
Infrastructure Setup: report server and the sql Job that downloads the files and store everything are in SAME server.
Current Code"
Dim httpConn As ConnectionManager = Dts.Connections("ReportServer " & strServer)
Dim clientConn As HttpClientConnection = New HttpClientConnection(httpConn.AcquireConnection(Nothing))
Dim docItemID As String = CType(Dts.Variables("User::DocItemID").Value, String)
Dim ReportFileName As String = CType(Dts.Variables("User::FolderLocation").Value, String) & docItemID
Dim TransportFee As Decimal = CType(Dts.Variables("User::TransportFee").Value, Decimal)
clientConn.ServerURL = "http://XXXX" & strServer & "/ReportServer?/XXXX-Reports/" & strString & "&docItemId=" & docItemID & "&type=3&rs:Command=Render&rs:Format=PDF&rc:Toolbar=False"
clientConn.DownloadFile(ReportFileName & ".pdf", True)
Problem: Even if server CPU usage is not much that means server is not busy, still in one hour only 300 files are getting downloaded.
Can you please suggest what other options we have to handle this situation? Now can we download 1000 pdf in one hour.
Shall we increase the CPU core or do you think any other class can give better performance than HttpClientConnection.
Thanks in advance
Dont forget to click “Mark as Answer” on the post that helped you.This credits that member, earns you a point and mark your thread as Resolved for the sake of Future Readers
Contributor
2990 Points
1210 Posts
Re: Download PDF from SSRS using HttpClientConnection performance ISSUE
Sep 21, 2017 11:07 PM|Deepak Panchal|LINK
Hi joydeepsen,
I find one code in C#. I can see that you are using VB.Net.
so I convert that code to VB.Net using code convertor.
below is a links for the original code that you can try to refer to get more information.
it can download multiple files simultaneously which can help you to increase performance.
the above code is just an example, you need to modify it as per your requirement.
Regards
Deepak
Please remember to click "Mark as Answer" the responses that resolved your issue.
If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.
Contributor
2775 Points
783 Posts
Re: Download PDF from SSRS using HttpClientConnection performance ISSUE
Oct 05, 2017 08:45 AM|joydeepsen|LINK
thanks for the reply. The whole process happens through a sql agent job which intern calls a SSIS/DTSX package. There is a Foreach ADO Enumerator in the SSIS package. In each iteration, a documentId is passed to the report server and downloads one pdf at a time. each call looks like
http://servername/ReportServer?/APPNAME-Reports/InvoiceGE&docItemId=1847311&type=3&rs:Command=Render&rs:Format=PDF&rc:Toolbar=False
So parallel downloading might not be possible in our case.
Dont forget to click “Mark as Answer” on the post that helped you.This credits that member, earns you a point and mark your thread as Resolved for the sake of Future Readers
Contributor
2990 Points
1210 Posts
Re: Download PDF from SSRS using HttpClientConnection performance ISSUE
Oct 17, 2017 03:00 AM|Deepak Panchal|LINK
Hi joydeepsen,
you had mentioned that,"So parallel downloading might not be possible in our case."
then it will be tough to achieve your requirement with in 1 hour of time.
you can think that if you just download a single file at a time then performance will be drop and will take much more time to finish this job.
so you can try to think redesign the whole process if possible and necessary for you to get the better performance.
Regards
Deepak
Please remember to click "Mark as Answer" the responses that resolved your issue.
If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.