Hi Everyone

 

I am trying to use the multithreaded version of ICS and have read all the
mailing list archives, and searched the searchable archives (when they were
working a month or so ago) and looked at the Wiki (when that was working
some time ago) but have a few questions.  By the way it would be great if
the Wiki was fixed even though this is a basic reference, it is better than
nothing when you're a newbie.

 

My application consists of a producer, and a multithread server accepting
client connections.  As a client is created, they are allocated RX and TX
FIFO's.  As a client receivs data the Client.OnDataAvailable event is used
to push data from the stack into the RX FIFO and then the data (which is a
stream of packets) is processed (part packets are left in the FIFO until the
rest of the packet arrives from the client).  On the TX side the producer
(actually a throttled stream of data, also packetised) needs to send data to
all of the TWSocketThrdServer connected clients.  Currently I do this by
iterating through the list of clients in another thread, and access each
client through the Server.Client[xx] property of the TWSocketThrdServer.
For each client, I first push data (packetised stream of data) into the TX
FIFO, and then use the Client.OnDataSent event copy take data from the TX
FIFO and actually place it in the stack buffers, using Client.Send.  As the
OnDataSent event only fires after data has been sent, and there will be
times that the FIFO is empty and so there is nothing to send, or cause the
event to fire again, I force the event to be fired (as data is being pushed
into the TX FIFO) by using the Server.Client[xx].Resume function.

 

All of this is working, and as far as I can tell it is stable.  I can
connect and stream to approximately 3500 clients (500 per thread)
simultaneously on an I7 machine (local loopback) which gives a total server
to client data rate of approximately 450Mb/s and uses approximately 30% CPU.
I am quite pleased with this!

 

So here are my immediate questions:

- When I push this to 4000 clients, things start to go a bit pear shaped and
the server grinds to a halt and locks.  Up until that point everything seems
okay, clients connecting/disconnecting on mass is fine, data rate is
maintained etc etc.  Approx 4000 clients just kills it.  Is there something
I am not aware of?  Any suggestions of things to look at?

- In the documentation/mailing list (not really talking about the
TWSocketThrdServer) it says that you need to ensure that the MessagePump is
called.  My Windows Service application creates the TWSocketThrdServer in a
background thread and I have set Multithreaded to TRUE.  Everything is
working, but am I doing this correctly?

- When my clients connect, the first 2 thousand connect quite quickly
(within a couple of seconds), however the next 1 thousand take a lot longer
to be accepted (up to 50 additional seconds)  are there any options for the
listen queue?

- When I disconnect clients from the client end I sometimes get an exception
raised in the OnClientDataSend event handler - [ESocketException][Socket is
not connected (#10057 in Send)].  The event is obviously firing, but the
socket has already closed.  Is there a way to test for this condition so
that the exception does not occur.  I have tried using the Connected client
property but still the exception is raised.  Again, I can trap the exception
and everything works, but is there a better way.  I guess this is related to
me using Resume to kick start the Data Send.

- I was hoping to get nearer towards supporting 5K clients at 16KB/s per
client but this is simply not possible at the moment.  Are there any
suggestions as to what can be done to achieve this or improve on what I have
already done.

 

Any other comments on what I am doing will also be appreciated.

 

Regards,

Tim

-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be

Reply via email to