Is there a way to make a threading/async post with a web reference not slow down the whole website just because the web reference takes a long time to return a response?
I have a send email function that gets posted async with a threading system that basically looks like this. This whole .cs file is called Mail.cs (that's where the Mail. name comes from).
public static bool SendMail(var alotOfVariablesHere)
MailParameters param = new MailParameters(alotOfVariablesHere);
Thread thread = new Thread(Mail.QueueSendMailAsyc);
static Object locker = new object();
public static void QueueSendMailAsyc(object Objparam)
SendMailAsyc() we run our web reference:
WebReference.Service1 Converter = new WebReference.Service1();
Converter.Timeout = 3 * 60 * 1000;
byte file = Converter.ConvertFunction(File.ReadAllBytes(attachfilepath), fileName);
The only thing the
WebReference does is receiving a byte array and a file name and then returns a new byte array.
Pretty simple and it all works fine.
But recently the server were the web reference is sitting on (a totally different server from the webpage) has started getting really slow. This means that the web reference takes a long time to respond (it does respond and it does return everything like the way we want it. just that it's now a lot slower)
And this has started causing a lot of issues, like: The webpage also get really slowed down, it takes ages to navigate through the pages and so on.
Plus the fact that this one single web reference threading/async post takes so long time means that there is plenty of time to put up even more threading/async posts meaning it'll put an even bigger pressure on the server, causing it to slow down a lot.
This issue is primary that the web reference has gotten really slow lately, and that our webpage server cannot handle the pressure of too many threads/async posts.
I can't do much about the server the web reference is sitting on has started getting really slow recently.
But is there anything I can do code-wise to make my system handle this really slow web reference better?