Faced with the following problem at the same time sending 100 requests the server starts to slow down the adoption of a new query, the first 100 requests trigger a function that is performed for 1 minute and wait for the end of execution, 101 request I send a short call from the browser function that prints string and number of how many requests still running in parallel.
So after all the 100 requests and began working in the stream, the 101 function is quick and shows that 100 threads now running in parallel.
watched a lot of information on the Internet, everything seems as it should do but still no result
using NF 4.5
class attributes are set to work in parallel C # code
[CallbackBehavior(UseSynchronizationContext = false)]
[ServiceBehavior(InstanceContextMode = InstanceContextMode.PerCall, ConcurrencyMode = ConcurrencyMode.Multiple, MaxItemsInObjectGraph = 2147483646)]
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
[ServiceContract(SessionMode = SessionMode.NotAllowed)]
function emulation load for 1 minute C # code
private static int threads11 = 0;
[OperationContract]
[WebGet(BodyStyle = WebMessageBodyStyle.Bare, ResponseFormat = WebMessageFormat.Json)]
public string loadConcurency()
{
threads11++;
var count = 0;
while (count < 6000)
{
count++;
Thread.Sleep(10);
}
threads11--;
return "1";
}
function test statistic C # code
[OperationContract]
[WebGet(BodyStyle = WebMessageBodyStyle.Bare,
ResponseFormat = WebMessageFormat.Json)]
public string ReportTest()
{
try
{
StringBuilder response = new StringBuilder().AppendLine("threads=" + threads11.ToString() + "; ");
response.AppendLine();
return response.ToString();
}
catch (Exception ex)
{
return ex.ToString() + (ex.InnerException == null ? "" : ex.InnerException.ToString());
}
}
serviceThrottling set very high
<behavior name="ServiceBehavior">
<serviceMetadata httpGetEnabled="True" />
<serviceDebug includeExceptionDetailInFaults="true" />
<serviceThrottling maxConcurrentCalls="3000" maxConcurrentSessions="30000" maxConcurrentInstances="3000" />
</behavior>
I hope those who met with such problem and will prompt what the problem, or at least give advice where else to dig