The TcpClientConnectionPool is not work?

Topics: Developer Forum
Feb 8, 2008 at 3:42 PM
IndexusMessage.cs:


public bool Send()
{
TcpClient client = null;
try
{
client = Handler.TcpClientConnectionPool.GetTcpClient(this.hostname, Ports.PortTcp()); //this.hostname, Ports.PortTcp()
...
client.Close(); //why close the socket ???

...
finally
{
Handler.TcpClientConnectionPool.PutTcpClient(client);
}


the TcpClientConnectionPool.cs:


public static void PutTcpClient(TcpClient client)
{
if (TcpClientConnectionPool.availableTcpClients.Count < TcpClientConnectionPool.POOL_SIZE)
{
if (client != null)
{
if (client.Connected)
{
// Set the socket back to blocking and enqueue
client.Client.Blocking = true;
TcpClientConnectionPool.availableTcpClients.Enqueue(client);
}
}
}
else
Feb 9, 2008 at 1:55 PM
Edited Feb 9, 2008 at 1:55 PM
Hi Wuchang,
yup you are def. right that the current check-in does not use the Socket Pool as it should since we had seen that we have some problems
with Block=true; on the server side. this is one of the reasons why we are doing a lot of prototyping right now to re-write this communication
stuff under the hood.
currently we are try to evaluate which would be the best option to use:
  • socket poll on server and client
  • socket select
  • async client and server
and some more. this is the main reason why we haven't done any new changes since 2 - 3 weeks but we are working hardly to come up
with the most performance and efficient way for shared cache and its users.
if you have some experience with one of the above issues please feel free to contact us and share with us your experience to come up with the best solution.

please mention, that even now, since we are open / close every time a new socket we are fast but we can be faster and we want to achieve the fastest way we can. in case you have some resources / code segments you would like to share with use to process faster with these changes feel free to send them to: sharedcache[AT]indexus[DOT]net

thanks for being patient, regards, roni
Feb 9, 2008 at 4:18 PM
why don't use I/O Completion Port ?

http://msdn2.microsoft.com/en-us/library/aa365198(VS.85).aspx
Feb 9, 2008 at 9:57 PM
Edited Feb 9, 2008 at 9:57 PM

thanks for the link, as already mention we are prototyping very hard in the past few day's to find the most performance and scalable way to handle the communication between the client and the server. if you like to have a look at the current status ( which is not complete at all ) you are welcome to download the sample: Async Server Socket Prototype - SocketPrototype4.zip
Feb 10, 2008 at 10:16 PM
This problem will be solved with the version: 2.0.0.140 which I gone pre-release within the next 2 day's
Feb 11, 2008 at 2:42 AM
Good!

thanks!
Feb 12, 2008 at 8:51 PM
Edited Feb 12, 2008 at 8:51 PM
please download latest pre-release: pre_release_2.0.0.140 - pre_release_2.0.0.145 this solved this issue