.NET Framework Bookmark and Share   
 index > .NET Remoting and Runtime Serialization > Is there a way to configure "backlog queue" at the .NET Remoting channel/port level, similar to the WCF listenBacklog?
 

Is there a way to configure "backlog queue" at the .NET Remoting channel/port level, similar to the WCF listenBacklog?

<bindings>

<netTcpBinding>

<binding name="DiamBinding" closeTimeout="00:10:00" openTimeout="00:10:00" sendTimeout="00:10:00" listenBacklog="100" maxBufferPoolSize="500000000" maxBufferSize="500000000" maxConnections="1000" maxReceivedMessageSize="500000000" portSharingEnabled="true">

<readerQuotas maxDepth="32" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="8192" maxNameTableCharCount="2147483647" />

<security mode="None"/>

</binding>

Thanks in advance,
Somchai

Somchai S_

Looking into .NET Remoting Channel (System.Runtime.Remoting.Channels):

I think there is a major flaw, in the .NET Remote Channel code, when

the “outstand request queue�reached 250.

The problem is that the value is hard coded as follows:

1. static internal class CoreChannel

2. {

3. private static IByteBufferPool _bufferPool = new ByteBufferPool(10, 4096);

4. private static RequestQueue _requestQueue = new RequestQueue(8, 4, 250);

5.

When the queue is greater than 250(this._queueLimit), per the following MS code, it will drop

that request:

internal SocketHandler GetRequestToExecute(SocketHandler sh)

{

int num;

int num2;

ThreadPool.GetAvailableThreads(out num, out num2);

int num3 = (num2 > num) ? num : num2;

if ((num3 < this._minExternFreeThreads) || (this._count != 0))

{

bool isLocal = IsLocal(sh);

if ((isLocal && (num3 >= this._minLocalFreeThreads)) && (this._count == 0))

{

return sh;

}

if (this._count >= this._queueLimit)

{

sh.RejectRequestNowSinceServerIsBusy();

return null;

}

this.QueueRequest(sh, isLocal);

if (num3 >= this._minExternFreeThreads)

{

sh = this.DequeueRequest(false);

}

else if (num3 >= this._minLocalFreeThreads)

{

sh = this.DequeueRequest(true);

}

else

{

sh = null;

}

if (sh == null)

Somchai S_

Looking into .NET Remoting Channel (System.Runtime.Remoting.Channels):

I think there is a major flaw, in the .NET Remote Channel code, when

the “outstand request queue�reached 250.

The problem is that the value is hard coded as follows:

static internal class CoreChannel

{

private static IByteBufferPool _bufferPool = new ByteBufferPool(10, 4096);

private static RequestQueue _requestQueue = new RequestQueue(8, 4, 250);


When the queue is greater than 250(this._queueLimit), per the following MS code, it will drop

that request:

internal SocketHandler GetRequestToExecute(SocketHandler sh)

{

int num;

int num2;

ThreadPool.GetAvailableThreads(out num, out num2);

int num3 = (num2 > num) ? num : num2;

if ((num3 < this._minExternFreeThreads) || (this._count != 0))

{

bool isLocal = IsLocal(sh);

if ((isLocal && (num3 >= this._minLocalFreeThreads)) && (this._count == 0))

{

return sh;

}

if (this._count >= this._queueLimit)

{

sh.RejectRequestNowSinceServerIsBusy();

return null;

}

this.QueueRequest(sh, isLocal);

if (num3 >= this._minExternFreeThreads)

{

sh = this.DequeueRequest(false);

}

else if (num3 >= this._minLocalFreeThreads)

{

sh = this.DequeueRequest(true);

}

else

{

sh = null;

}

if (sh == null)

{

this.ScheduleMoreWorkIfNeeded();

}

}

return sh;

}

Subsequently, the client will get the following error, when trying to access that port:

"No connection could be made because the target machine actively refused it 192.xxx.x.xx:8089"

Unfortunately,and unlike WCF, the above is not configurable(per the above code). And in order

to confirm this, I would like to post the question on MS Forums

BTW, for WCF, it is nicely done as follows:

try

{

this.listenSocket = new Socket(this.localEndpoint.AddressFamily, SocketType.Stream, ProtocolType.Tcp);

if ((this.localEndpoint.AddressFamily == AddressFamily.InterNetworkV6) && this.settings.TeredoEnabled)

{

this.listenSocket.SetSocketOption(SocketOptionLevel.IPv6, SocketOptionName.HopLimit | SocketOptionName.BsdUrgent, 10);

}

this.listenSocket.Bind(this.localEndpoint);

this.listenSocket.Listen(this.settings.ListenBacklog);

this.isListening = true;

continue;

}

We have been chasing the performance issue on our deployed production service. And we think that the
above hard-
coded value as 250, is mysteriously dropping our client connections.

Please note that, unfortunately, we are unable to convince our client to use WCF yet.

Could someone from Microsoft please provide us some guideline on how to increase the backlog queue value, for .NET Remoting Channel/port.

Thank you very much in advance for your help,

Somchai

Somchai S_

Additionally, the .NET Remoting Version 2.0 , does not start up the Socket with the “backlog�defined
( It instead utilizes its internal requestqueue that I just mentioned) :

internal class ExclusiveTcpListener : TcpListener
{

internal void Start(bool exclusiveAddressUse)
{
bool flag = ((exclusiveAddressUse && (Environment.OSVersion.Platform == PlatformID.Win32NT)) && (base.Server != null)) && !base.Active;
if (flag)
{
base.Server.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ExclusiveAddressUse, 1);
}
try
{
base.Start(); // Does not specify backlog here, i.e., public void Start(int backlog);
}
catch (SocketException)
{
if (!flag)
{
throw;
}
base.Server.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ExclusiveAddressUse, 0);
base.Start();
}
}

Somchai S_

You can use google to search for other answers

Custom Search

More Threads

• How to create a SOAP document?
• How Proxy gets created in client side without communicating to server for SAO in Remoting
• Where can I deploy Remoting objects?
• Binary Serialization of Objects w/ references
• Deserialization using BinaryFormmater and FileStream
• Detecting which client is calling a MarshalByRefObject
• Where can I find a good article on remoting with datasets and datatables, not just "Hello User!!!"
• Serialization Diagnostics Tools
• Firewall blocks remoting connection.
• .NET Remoting, RemotingConfiguration.Configure -> RemoteException