I have the following scenario:
We have an ASP.Net website, which generates a PDF report. To generate the PDF report we need to make multiple web-service calls (each call returns a part of the data). Most of the calls are to the same endpoint, but the methods and the parameters are different. To improve performance, we have thought of the following 2 approaches:
- Expose a web service operation that accepts parameters for all the individual calls. Internally, this method calls each of the methods one by one; when completed, it packs all the responses in a collection and sends it back. The ASP.Net web page then receives the list of responses and unpacks them and generates the report.
- Make parallel calls to the web service methods from the ASP.Net application. When all parallel calls are completed, collect all the responses and generate the PDF.
At first, the 2nd approach looks elegant; the problem is, how do we make the parallel web service calls. Thread.QueueUserWorkItem is not a good option as suggested here: Using ThreadPool.QueueUserWorkItem in ASP.NET in a high traffic scenario and http://williablog.net/williablog/category/Scalability.aspx
Creating new threads using new Thread() is also not great as suggested here: http://blogs.msdn.com/b/tmarq/archive/2010/04/14/performing-asynchronous-work-or-tasks-in-asp-net-applications.aspx
Further, the web apps code is layered with a UI and a Business Logic Layer that invokes the web service methods. The site is not a very heavy load site, with about 200 concurrent users.
Request to help with suggestions to improve the performance of the pdf generation process.
Thanks and Regards
Vikas