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