WCF in Mono 2.10.9 performance issues

I have a simple WCF host and client which run fine in Windows but suffer extremely bad performance on Mono 2.10.8/9.

The WCF host is running in a self-hosted console app. WCF client is also a simple console app. They're using netTcpBinding without any security.

Here's the host app.config:

<?xml version="1.0" encoding="utf-8"?>

<configuration>
  <system.serviceModel>
    <behaviors>
      <serviceBehaviors>
        <behavior name="MetadataBehavior">
          <serviceMetadata />
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <services>
      <service behaviorConfiguration="MetadataBehavior" name="EmployeeServiceLib.EmployeeService">
        <clear />
        <endpoint address="net.tcp://localhost:8888/EmployeeService/tcp"
          binding="netTcpBinding" bindingConfiguration="ultra" name="EmployeeService"
          contract="EmployeeServiceLib.IEmployeeService" listenUriMode="Explicit" />
      </service>
    </services>
    <bindings>
      <netTcpBinding>
        <binding name="ultra" transactionFlow="false" transferMode="Streamed">
          <reliableSession enabled="false" />
          <security mode="None" />
        </binding>
      </netTcpBinding>
    </bindings>
  </system.serviceModel>
</configuration>

client app.config:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <system.serviceModel>
        <bindings>
            <netTcpBinding>
                <binding name="EmployeeService" closeTimeout="00:01:00" openTimeout="00:01:00"
                    receiveTimeout="00:10:00" sendTimeout="00:01:00" transactionFlow="false"
                    transferMode="Streamed" transactionProtocol="OleTransactions"
                    hostNameComparisonMode="StrongWildcard" listenBacklog="10"
                    maxBufferPoolSize="65536" maxBufferSize="65536" maxConnections="10"
                    maxReceivedMessageSize="1048576">
                    <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
                        maxBytesPerRead="4096" maxNameTableCharCount="16384" />
                    <reliableSession ordered="true" inactivityTimeout="00:10:00"
                        enabled="false" />
                    <security mode="None" />
                </binding>
            </netTcpBinding>
        </bindings>
        <client>
            <endpoint address="net.tcp://localhost:8888/EmployeeService/tcp"
                binding="netTcpBinding" bindingConfiguration="EmployeeService"
                contract="EmployeeService.IEmployeeService" name="EmployeeService" />
        </client>
    </system.serviceModel>
</configuration>

WCF Service class:

[ServiceBehavior(ConcurrencyMode = ConcurrencyMode.Multiple, InstanceContextMode = InstanceContextMode.Single,
    AddressFilterMode = AddressFilterMode.Any)]
public class EmployeeService : IEmployeeService
{
    private readonly List<Employee> m_Employees = new List<Employee>();

    #region IEmployeeService Members

    public void AddEmployee(Employee employee)
    {
        m_Employees.Add(employee);
    }

    // ... snipped ...
}

What the client does is calling an OperationContract 100 times and benchmark the calls.

var employee = new Employee { ... };
var client = new EmployeeServiceClient("EmployeeService", "net.tcp://localhost:8888/EmployeeService/tcp");
client.Open();
Console.Write("Adding 100 employees...");
var startTime = Environment.TickCount;
for (int i = 0; i < 100; i++)
{
    client.AddEmployee(employee);
}
var timeTaken = Environment.TickCount - startTime;
Console.WriteLine(" Done.");

Benchmark result:

.NET 4.0 = 62 ms

Mono 2.11.1 = 1672 ms

Mono 2.10.9 in Debian 6 running in VM = 9632 ms (CPU usage hovering around 1%)

What can I do to speed up the performance of WCF on Mono esp in Debian?

Answers


Need Your Help

Socket error when connecting to remote machine with Python

python unix ssh paramiko

I am using Python's paramiko package to connect to a remote Unix machine. I have written this code:

why are we using relative scheme // instead of http:// or https://?

html html5 http

I've been having lots of problems with this new trend. It's been included everywhere (e.g. htmlboilerplate / twitter widgets) yet even twitter itself doesn't like it... (see image, when trying its

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.