Rank: Newbie Groups: Member
Joined: 1/29/2014 Posts: 3
|
I am implementing a PDF conversion process in which a user will select a list of pages from our site to convert to PDF and then a background process will generate all of the PDFs for the pages. When doing this one at a time no issues appear, but when multiple requests are made at the same time or when large amounts of page conversions are requested issues start appearing. Currently I have each request spawn 2 threads which will go through the list of pages and start generating PDFs, and what seems to be happening is that threads will hang on the conversion call and never move on, or they will throw the following exception - Failed to convert Url "passed in url".(1056:A network error occurred.)
The problem with this exception is that the site is still running when the exception is thrown. I am still able to access the pages that are being generated by navigating to the given URL. If the threads are hanging when I look at the server that is running this process I will usually find a rundll32.exe process running at 100% CPU, which is most likely what is hanging the process. Also this issue doesn't occur right away, it usually takes at least 50 conversions before it starts failing. Is there some kind of limitation on the number of PDFs I can have being generated at the same time? Or is there a limit to the number of total PDFs a single process can produce in one session?
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,196
|
Hi,
There is no hard limitation on how many thread you can run because it depends on your system. Generally it is not a very good idea to create two many threads to do multiple conversions at the same time. The conversions are both network intensive (during the loading stage) and CPU intensive (during the conversion stage). You will have performance gain when you have just a few threads because while a few are waiting on the network, a few others can use CPU (assume that you have multiple CPU cores). But when you have too many threads, they are just over competing and rob each other off since the amount of available resource is still fixed in your system. In that case you might find one stuck at the conversion stage using 100% CPU, which will slow down others as well (even the network intensive loading still need CPU to do a lot of things), which eventually cause a network failure (1056) for you, which basically is a system overload. So I would recommend you to try to reduce the number of threads first.
Thanks!
|