Silverlight WCF Compatible

I am trying to investigate an issue reported by another developer. He argued that when the Silverlight application we created hits the WCF web service hard with concurrent calls, the calls start to stack on the server. His claim was that we are using sessions because of the authentication method we are using (using forms and asp.net membership for sql). So I created a really simple test application

Screen shot of test application

The app allows me to specify the number of concurrent calls for the web service I want, and then it specifies the current number of outstanding calls and the average response time in seconds.

The web service itself just sleeps the thread on the second

    public void DoWork()
    {
        Thread.Sleep(1000);
    }

      

So, I thought that if my coworker was right, then the calls would add up to the server, so the average response would be 2 seconds if there are two concurrent calls. However, it looks like the time stays at just over a second until I get up to seven concurrent requests, and then it starts to increase relatively predictably.

Launching the second client (in a Chrome window next to the original IE window) doesn't seem to have a performance impact (there is an initial hiccup). This is not the case if you run two IEs or two Chromes next to each other, then the two seem to affect each other, assuming they are using a connection.

It also appears that the violinist intervened. I ran the application without a fiddler with 7 concurrent calls and it averaged about 1.15 seconds per call. Then I started playing fiddler and the time was thrown away for just over a second, it was as if the fiddler was letting emergency calls go through.

So my question is. What's going on here? Where does the throttling (6 concurrent requests) occur (client or server)? Why does running a script speed up requests?

Additional Information.

The web service class has multiple attributes

[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Required)]
[ServiceBehavior(ConcurrencyMode = ConcurrencyMode.Single, InstanceContextMode = InstanceContextMode.PerSession)]
public class DoVeryLittle : IDoVeryLittle
{
    public void DoWork()
    {
    }
}

      

AspNetCompatibilityRequirements is designed to integrate with asp.net pipeline and authentication. ConcurrencyMode and InstanceContextMode ServiceBehavour appears to be instantiated and instances per session. However, we are using basicHttpBinding for the endpoint, and I saw that this does not support sessions, so I am a bit confused about this.

For completeness, here are the service related entries in the web.config

<system.serviceModel>
    <behaviors>
        <serviceBehaviors>
            <behavior name="">
              <serviceMetadata httpGetEnabled="true" />
              <serviceDebug includeExceptionDetailInFaults="true" />
              <serviceAuthorization principalPermissionMode="UseAspNetRoles" roleProviderName="AspNetSqlRoleProvider" />
            </behavior>
        </serviceBehaviors>
    </behaviors>
  <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
</system.serviceModel>

      

+2


source to share


2 answers


The 6 concurrent connections limit sounds like a max forced by IE.

You didn't list your IE version, but here's a link for IE8, including instructions to change the limitation: Connectivity improvements in Windows Internet Explorer 8



I would try to play with the limit and see if it affects your results.

+2


source


OK with some help i found the explanations i need.

  • Why is my colleague facing the issue of concurrent WCF calls?

Okay, he probably wasn't. During my tests, I needed to change the service attributes as follows to reproduce the problem.

[ServiceBehavior(ConcurrencyMode = ConcurrencyMode.Single, InstanceContextMode = InstanceContextMode.Single)]

      

This forces a single instance of the service to be created and then the concurrent calls to be stacked. I originally had attibutes

[ServiceBehavior(ConcurrencyMode = ConcurrencyMode.Single, InstanceContextMode = InstanceContextMode.PerSession)]

      



And it will specifically create a new service for each new session. However, I also found that every call gets a new session and this is because we are using BasicHttpBinding which does not support sessions.

  • Why is there a limit of 6 simultaneous calls?

Most likely, as Boris mentioned, the limit for the browser and then the client stack we were using. While I was unable to change the setting to see if it mattered, it makes sense that the number 6 appears consistently in both cases.

  • Why does the violinist change this?

I really don't have a solid idea about this and would welcome someone else.

+2


source







All Articles