2
I realized that when called by XHR, the ASMX webservices can handle few simultaneous requests. Consider the following scenario:
Page ASPX:
<asp:ScriptManager ID="scrManager" runat="server">
<Services>
<asp:ServiceReference Path="~/WebService.asmx" />
</Services>
</asp:ScriptManager>
Webservice method:
[WebMethod]
public string HelloWorld()
{
Thread.Sleep(1000);
return "Hello World";
}
And the Javascript code that calls it:
$(document).ready(function () {
var ws = new WebApplication1.WebService();
for (var i = 0; i < 100; i++) {
var start = new Date().getTime();
function sucesso() {
var end = new Date().getTime();
var time = end - start;
console.log('Duração: ' + time);
}
ws.HelloWorld(sucesso, function () { alert("erro"); });
}
});
And the result is more or less this:
I expected each request to take approximately 1s, but with each more or less 5 requests, the waiting time increases. That is, the request was on hold, because there were other connections open. My question is: how to increase the number of simultaneous requests, so that more calls take the same time. I know it would not be good if the 100 requests were opened at once, but I find very little the number I currently have.
Searching around, I found the following configuration (web.config) but it didn’t work:
<system.net>
<connectionManagement>
<add address="*" maxconnection="40"/>
</connectionManagement>
</system.net>
Note: I know that web services made with asmx are a legacy technology, but I have a whole large system that uses them on the front end, in a similar way to the one exposed here. It is not an option now to change the technology.
Good question, I do not understand why Asp.net here is little visited.
– Marconi
Since you changed the server-side order limit and did not produce the expected results, is it possible that "Bottleneck" is on the client side? There may be an order limit on the customer?
– bruno
I don’t think it’s from the client’s side, so I remember if I made the call from the webservice via c# the result was the same. I think the config that I explained here that is not the correct one, I need to find out what it is, if it exists. I will do the call tests via . NET and post the result here to take the web of a possible bottleneck in the customer.
– Marcus Vinicius
Try to implement your method and your calls asynchronously, this should improve your results.
– Icaro Bombonato
Can you give an example?
– Marcus Vinicius