Re: [twsocket] Thread Opinion

2006-10-30 Thread Michael Preslar
Angus Robertson - Magenta Systems Ltd wrote:
>> Do you mind if I reply via private email?
> 
> No problem. 

Email sent.. I wrote it last night while the thoughts were fresh in my 
mind.. Sorry for it being so long!

>> I'm afraid this particular topic may quickly run away from the ICS 
>> mailing list topic(s)
> 
> It is a question asked probably once a month, albeit some people may get 
> bored by the same answers each month. 

True, I know I've seen it a good number of times.. And I'll agree, 
threads aren't the cure all for servers - in truth, they're rarely 
needed. But once you read the email I just sent, you'll be able to 
(hopefully) see why I thought threads would be a good idea.

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


Re: [twsocket] Thread Opinion

2006-10-30 Thread Angus Robertson - Magenta Systems Ltd
> Do you mind if I reply via private email?

No problem. 
 
> I'm afraid this particular topic may quickly run away from the ICS 
> mailing list topic(s)

It is a question asked probably once a month, albeit some people may get 
bored by the same answers each month. 

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


Re: [twsocket] Thread Opinion

2006-10-29 Thread Francois Piette
> As far as threads.. Was thinking that TWSocket itself would not be in a
> thread.. However, the packet processor and relay code would be.. More
> specifically, at the server level, buffer the incoming data to some
> pre-determined amount, then fire off a thread to process that buffer..

Using a thread for offloading blocking processing is a good thing.
Using a single thread for all TWSocket stuff is also good if you have a
really fast network. In that case using the main thread for both GUI and
network I/O woul make the application less responsive to the user, therefore
a worker thread for network I/O is good. With slow network (depending on
your hardware, slow mean something below 10 Mbps) the main thread is
frequently enough for both the GUI and network I/O. It is not the number of
client which matters, it is the global thruput which cannot be higher than
cable thruput of course.


Contribute to the SSL Effort. Visit http://www.overbyte.be/eng/ssl.html
--
[EMAIL PROTECTED]
Author of ICS (Internet Component Suite, freeware)
Author of MidWare (Multi-tier framework, freeware)
http://www.overbyte.be


- Original Message - 
From: "Michael Preslar" <[EMAIL PROTECTED]>
To: "ICS support mailing" 
Sent: Sunday, October 29, 2006 11:18 PM
Subject: [twsocket] Thread Opinion


> I know, I know, its been said many times on this mailing list that
> threads are usually a Bad Thing, and that TWSocket in async mode can
> handle most anything with ease..
>
> But still, I have to ask for you guys' opinion..
>
> The client server would not be multi-threaded.. Theres just not enough
> data to worry about for the clients..
>
> But the server.. Each client would be sending data packets, 1024 bytes
> or less, and quite possibly very rapid fire.
>
>  From there, the server takes the incoming packet, parses it, makes
> changes to the local data stores, and then relays the packet (sometimes,
> a modified packet) on to all other clients that are connected.
>
> As far as threads.. Was thinking that TWSocket itself would not be in a
> thread.. However, the packet processor and relay code would be.. More
> specifically, at the server level, buffer the incoming data to some
> pre-determined amount, then fire off a thread to process that buffer..
>
> Thoughts?
>
> --
> Michael
> -- 
> To unsubscribe or change your settings for TWSocket mailing list
> please goto http://www.elists.org/mailman/listinfo/twsocket
> Visit our website at http://www.overbyte.be

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


Re: [twsocket] Thread Opinion

2006-10-29 Thread Michael Preslar
Angus Robertson - Magenta Systems Ltd wrote:
>> As far as threads.. Was thinking that TWSocket itself would not be 
>> in a thread.. However, the packet processor and relay code would 

> new line triggered off the write event for the last line, with a FIFO 
> buffer in case data arrives faster than SQL can write it, but it handles 
> 50 lines a minute easily, while capturing 15 streams simultaneously.  
> 
> Angus

Angus,

Do you mind if I reply via private email?

I'm afraid this particular topic may quickly run away from the ICS 
mailing list topic(s), and I'd rather not upset those that generate the 
code that I find very useful.

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


Re: [twsocket] Thread Opinion

2006-10-29 Thread Angus Robertson - Magenta Systems Ltd
> As far as threads.. Was thinking that TWSocket itself would not be 
> in a thread.. However, the packet processor and relay code would 
> be.. More specifically, at the server level, buffer the incoming 
> data to some pre-determined amount, then fire off a thread to 
> process that buffer..

If you are sending the data with TWSocket as well, that will also be 
event driven, so can all run in the same thread.  It's only if your 
processing is going to block for more than a few milliseconds that you 
need to think about threads.  

I wrote an application recently (http://www.magsys.co.uk/comcap/) 
including ICS that captures and writes multiple IP streams to multiple 
disk files, relays those streams using IP, and writes them to SQL 
Server, all without any threads.  Even SQL is asynchronous, with each 
new line triggered off the write event for the last line, with a FIFO 
buffer in case data arrives faster than SQL can write it, but it handles 
50 lines a minute easily, while capturing 15 streams simultaneously.  

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


[twsocket] Thread Opinion

2006-10-29 Thread Michael Preslar
I know, I know, its been said many times on this mailing list that 
threads are usually a Bad Thing, and that TWSocket in async mode can 
handle most anything with ease..

But still, I have to ask for you guys' opinion..

The client server would not be multi-threaded.. Theres just not enough 
data to worry about for the clients..

But the server.. Each client would be sending data packets, 1024 bytes 
or less, and quite possibly very rapid fire.

 From there, the server takes the incoming packet, parses it, makes 
changes to the local data stores, and then relays the packet (sometimes, 
a modified packet) on to all other clients that are connected.

As far as threads.. Was thinking that TWSocket itself would not be in a 
thread.. However, the packet processor and relay code would be.. More 
specifically, at the server level, buffer the incoming data to some 
pre-determined amount, then fire off a thread to process that buffer..

Thoughts?

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