Critical Task Section #80200
Replies: 1 comment 5 replies
-
The actual delay here is probably between step 1 being submitted and the continuation (the code afterwards) being resumed. Step 2 doesn't actually need to be remote for this to be a problem. The actual HTTP request being complete isn't sufficient, it has to get back into C#'s process space, which is going to happen "when possible", essentially. Your best bet is probably multiple task schedulers with different thread pools for different parts of the data flow - one for the token retrieval and file download, and one for everything else. If your files are very large, you might need to have a custom task scheduler that migrates to a different thread pool after the download is started or something funny like that. Or you could go back to doing manual task submit and continuation creation, with |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I have a piece of async code that does the following:
Under low load, everything works fine, but when using dataflow with a high degree of concurrency, sometimes I see over a minute between step 1 completing and step 2 beginning. I have verified with fiddler that the HTTP request is complete so I suspect that the delay has something to do with the task scheduler running other threads.
Other than reducing concurrency, is there a way for me to say "This task is now time-sensitive. Run it ASAP."?
Beta Was this translation helpful? Give feedback.
All reactions