Discussion:
ICS or Indy for a new project ?
(too old to reply)
Ted
2003-07-13 13:37:19 UTC
Permalink
I need some honest opinions about these two fine sets. My only experience
with them are some mini projects a year ago, nothing special just for
learning Delphi sockets.
Nowdays the company i work for, started some projects and asked from all the
developers, opinions on sockets delphi / BCB addin tools.
Generally speaking, i know the difference between them two, but i have no
further experience on their difficulty, support, stability and speed.
I'll appreciate any advice...

thanks
Ted
Yahia El-Qasem
2003-07-13 13:55:18 UTC
Permalink
It depends on the sort of app you are developing...

We have some pretty big apps running ( in our LAN / WAN ) with ICS - it
works ok. It seems that there are some quirks the faster the LAN is and the
more connections there are... ( talking about 1 GBit/s and some 100
connections )...
We use the HTTP / FTP / TELNET client portions of ICS...

As far as I can say Indy AND ICS have a very good support through
newsgroups...

We are considering to switch to Indy in the hope that the above mentioned
problems won't strike us there...
We suspect that our problems has to do with the async nature of ICS ( using
the windows message system... ).
we have a lot of experience with multithreaded apps and would use just a
fair amount of threads to get along with the sync nature of Indy...

We are going to do some tests with Indy 9 / 10 to get a picture of the
robustness in our LAN environment...
Our development occurs on BCB 6 Ent - I can't say anything about delphi
etc...

For our Internet projects we used in the last couple of months wininet (
HTTP + FTP )... backgound for this decision was that it works fine with for
example Microsoft Proxy etc. - our internet connection is just sitting
behind several folds of firewalls / proxies...
Wininet is installed on the older WinOSs together with IE - the newer ones
( Win 2K Pro SP 3 and later ) have it already installed with OS.

Hope this somehow helps with your decision...

Yahia
Post by Ted
I need some honest opinions about these two fine sets. My only experience
with them are some mini projects a year ago, nothing special just for
learning Delphi sockets.
Nowdays the company i work for, started some projects and asked from all the
developers, opinions on sockets delphi / BCB addin tools.
Generally speaking, i know the difference between them two, but i have no
further experience on their difficulty, support, stability and speed.
I'll appreciate any advice...
thanks
Ted
Chad Z. Hower aka Kudzu
2003-07-14 00:32:26 UTC
Permalink
Post by Yahia El-Qasem
more connections there are... ( talking about 1 GBit/s and some 100
connections )...
100 connections is nothing.
Post by Yahia El-Qasem
As far as I can say Indy AND ICS have a very good support through
newsgroups...
Indy also has commercial support available as well.
Post by Yahia El-Qasem
We suspect that our problems has to do with the async nature of ICS (
the windows message system... ).
It causes serialization which bottlenecks desings that are not simple routing
like static HTML servers.



--
Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
"Programming is an art form that fights back"

Is Indy useful to you? Send a postcard please!
http://www.hower.org/kudzu/indypost.html


ELKNews - Get your free copy at http://www.atozedsoftware.com
newshound
2003-07-14 12:10:20 UTC
Permalink
Post by Chad Z. Hower aka Kudzu
It causes serialization which bottlenecks desings that are not simple routing
like static HTML servers.
Can you explain this further please. Are you saying that the message queue
serializes processing of incoming/outgoing traffic? What do you mean by
simple routing?
Andy M.
2003-07-14 17:02:43 UTC
Permalink
Post by newshound
Are you saying that the message queue
serializes processing of incoming/outgoing traffic?
Yes, of course it does - assuming that you are using the component
from the main-thread.
Every incoming data packet will raise an event and - as long as the
event is processed - the main-thread does nothing else and vice versa
(during, for example, a write call, no event can be processed). Plus,
*every* connection will raise an event in the main-thread, so as long
as one connection is processed, all others can do nothing but wait.
This is a serious issue to keep in mind when using event-driven comps
with only one thread.

Andy
Chad Z. Hower aka Kudzu
2003-07-15 02:20:55 UTC
Permalink
Post by Andy M.
This is a serious issue to keep in mind when using event-driven comps
with only one thread.
Bingo.


--
Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
"Programming is an art form that fights back"

Got Indy? Got the book?

http://www.atozedsoftware.com/indy/book/


ELKNews - Get your free copy at http://www.atozedsoftware.com
Francois Piette
2003-07-15 06:51:25 UTC
Permalink
Chad,
Post by Andy M.
This is a serious issue to keep in mind when using event-driven comps
with only one thread.
You completely forgot that using async sockets or event-driven comps doesn't
prevent you from using it within threads !

--
Contribute to the SSL Effort. Visit
http://overbyte.delphicenter.com/eng/ssl.html
--
***@overbyte.be
Author of ICS (Internet Component Suite, freeware)
Author of MidWare (Multi-tier framework, freeware)
http://www.overbyte.be
Chad Z. Hower aka Kudzu
2003-07-15 16:41:13 UTC
Permalink
Post by Francois Piette
Post by Andy M.
This is a serious issue to keep in mind when using event-driven comps
with only one thread.
You completely forgot that using async sockets or event-driven comps
doesn't prevent you from using it within threads !
Thats not the default. It requires the user to add code and it creates a
design that is not very optimal. Non blocking sockets were desinged for many
sockets to be handled by a thread. Yes you can put them in a thread, but its
a bit like eating soop with a fork. Or using blocking sockets without
threads.

If you are going to thread it anyways - then its best to use a spoon for the
soup and not a fork. :)


--
Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
"Programming is an art form that fights back"

Want more Indy stuff? Try the Atozed Indy Portal at
http://www.atozedsoftware.com/
* More Free Demos
* Free Articles
* Extra Support


ELKNews - Get your free copy at http://www.atozedsoftware.com
Tony Caduto
2003-07-15 04:40:55 UTC
Permalink
Yes,
but with ICS and a custom protocol, you would know when a long running
command was going to occur and you could pass off that socket to a thread to
handle it.

I believe there are some examples on the ICS/Overbyte web site.
Post by Andy M.
Post by newshound
Are you saying that the message queue
serializes processing of incoming/outgoing traffic?
Yes, of course it does - assuming that you are using the component
from the main-thread.
Every incoming data packet will raise an event and - as long as the
event is processed - the main-thread does nothing else and vice versa
(during, for example, a write call, no event can be processed). Plus,
*every* connection will raise an event in the main-thread, so as long
as one connection is processed, all others can do nothing but wait.
This is a serious issue to keep in mind when using event-driven comps
with only one thread.
Andy
Francois Piette
2003-07-15 06:57:16 UTC
Permalink
Post by Andy M.
Post by newshound
Are you saying that the message queue
serializes processing of incoming/outgoing traffic?
Yes, of course it does - assuming that you are using the component
from the main-thread.
But this is a bad assumption if this is not the behaviour you want. You can
use async socket from any thread. You can use a single comp per thread, or
as much comp as you like. You have full flexibility. Best of both world.
Post by Andy M.
This is a serious issue to keep in mind when using event-driven comps
with only one thread.
The important part of your sentence is "with only one thread". No one has
ever said that a single thread is good in all cases. What I say is that
using async sockets, you have the choise: a single thread for all sockets,
one thread for each socket or several threads each handling several sockets.
While using blocking sockets (indy) you have no choice: always one thread
per socket. This will cause trouble when you have a significant number of
concurrent connections.

--
Contribute to the SSL Effort. Visit
http://overbyte.delphicenter.com/eng/ssl.html
--
***@overbyte.be
Author of ICS (Internet Component Suite, freeware)
Author of MidWare (Multi-tier framework, freeware)
http://www.overbyte.be
Andy M.
2003-07-15 08:33:26 UTC
Permalink
Post by Francois Piette
But this is a bad assumption if this is not the behaviour you want. You can
use async socket from any thread. You can use a single comp per thread, or
as much comp as you like. You have full flexibility. Best of both world.
I know and I never said otherwise.
But then again, Chad's right with his remarks about
one-thread-per-connection systems. It's really not too much a problem
after all, whereas non-blocking sockets and thread-pools are really
not too easy to implement.
Plus, ICS *does* favour the classical main-thread approach since it
does use non-blocking sockets + windows messaging. If I use
non-blocking sockets in extra-threads I never use them with messages.
I use them like I'd use blocking sockets, basically.
Post by Francois Piette
The important part of your sentence is "with only one thread". No one has
ever said that a single thread is good in all cases. What I say is that
using async sockets, you have the choise: a single thread for all sockets,
one thread for each socket or several threads each handling several sockets.
While using blocking sockets (indy) you have no choice: always one thread
per socket. This will cause trouble when you have a significant number of
concurrent connections.
Note that I'm neither an extensive Indy nor an extensive ICS user, but
in most cases I do use blocking sockets the way Indy does and I rather
seldom use non-blocking sockets the way you suggest it.
So far this system does work well for me.
But this topic is becoming rather dogmatic anyway.
Most scenarios can be implemented with blocking and non-blocking
sockets. If you know how to use both, you can choose the best mode for
every given situation, since in most cases there is one design that
works better in a given scenario. My experience leads me to believe
though, that blocking sockets are easier to implement when the
scenarion works against them, than non-blocking sockets would be (just
think of state machines...).

Andy
Francois Piette
2003-07-15 08:51:19 UTC
Permalink
And Indy 10 operates on something much bigger which solves
any suck issues anyways.
Telling this, you implicitely admit there is a problem with blocking sockets
as implemented in Indy prior to version 10. Could you please explain what
new design is in Indy 10 and which issues it fixes in Indy 9 ?

--
Contribute to the SSL Effort. Visit
http://overbyte.delphicenter.com/eng/ssl.html
--
***@overbyte.be
Author of ICS (Internet Component Suite, freeware)
Author of MidWare (Multi-tier framework, freeware)
http://www.overbyte.be
Chad Z. Hower aka Kudzu
2003-07-15 19:09:55 UTC
Permalink
Post by Francois Piette
Telling this, you implicitely admit there is a problem with blocking
sockets as implemented in Indy prior to version 10. Could you please
You again make issues where there are none that have not been previously
stated. Maybe its just your English and unibtended, but this come off like
a sleazy prosecutor in a court trial.

Yes, Indy 9 has its limits. If you've read any of the threads involving
this before I have openly stated them. It does us no good to make posts
that are visibly false to intelligent developers. We have always openly
admittted limits, etc.

Indy will start to show strain around 1,000 ACTIVE connections. I have
pushed it 1,500 and even 2,000 but you need a good machine with a lot of
RAM. Even an actively loaded IIS rarely if ever pushes 1,000 active
connections. Its useless in most cases because of network limitations.

But the point is very few people write servers that handle 1,000 active
connections, so for 98% of the users its a mute point.
Post by Francois Piette
explain what new design is in Indy 10 and which issues it fixes in Indy
9 ?
This has been discussed in length as well and some is on the Indy site. In
short, fibers and/or IOCP. The big thing is that to the developer, the
model still remains blocking. Indy takes care of all the details.


--
Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
"Programming is an art form that fights back"

Is Indy useful to you? Send a postcard please!
http://www.hower.org/kudzu/indypost.html


ELKNews - Get your free copy at http://www.atozedsoftware.com
Martin James
2003-07-15 03:59:21 UTC
Permalink
Post by newshound
Can you explain this further please. Are you saying that the message queue
serializes processing of incoming/outgoing traffic? What do you mean by
simple routing?
Basically, 'non-blocking' components, driven by main-thread events fired by
Windows messages, are fine until any of the events needs to execute some op.
that requires a wait. If a wait is needed, (eg. a disk op. that cannot be
completed immediately). the whole app. is stuffed until the op. is done.
Blocking, threaded servers, eg. Indy, do not suffer from this bottleneck -
if one peer thread gets temporarily stuck on a disk read, the OS can still
run all the other peer threads & only the client requesting the disk read
has to wait.

The actual implications of this constraint are app-dependent. If the app.
does not perform any blocking ops, eg. 'simple routing', the effect is
minimal. When you have a lot of, say, database queries or file transfers,
then it becomes significant.

Rgds,
Martin
Francois Piette
2003-07-15 06:49:20 UTC
Permalink
Post by Martin James
Post by newshound
Can you explain this further please. Are you saying that the message
queue serializes processing of incoming/outgoing traffic?
Basically, 'non-blocking' components, driven by main-thread events fired by
Windows messages, are fine until any of the events needs to execute some op.
that requires a wait. If a wait is needed, (eg. a disk op. that cannot be
completed immediately). the whole app. is stuffed until the op. is done.
If you have some operation which has to wait (a blocking operation, not an
async operation), then you can always use a thread to execute it without
blocking. Without mention that you can always have a thread per connection
if this is what you want (see for example MtSrv sample program delivered
with ICS). Async socket doesn't prevent you from using multi-threading. It
let you choose the best design for your application ! At any time, you can
attach a TWSocket component to any thread using ThreadAttach method. And of
course as TWSocket is asynchronous, you can attach a lot of TWSocket to a
single thread. Depending on the network activity and the processing you
have, you could attach something like 50 TWSocket to a single thread.
Post by Martin James
Blocking, threaded servers, eg. Indy, do not suffer from this bottleneck -
if one peer thread gets temporarily stuck on a disk read, the OS can still
run all the other peer threads & only the client requesting the disk read
has to wait.
But you _MUST_ always write use thread while with ICS you use a thread only
when required. Much less threads in the system. With Indy, you _MUST_ have a
thread per connection which is really overkill. With lot's of connections,
your system will spend more time switching between threads than doing actual
processing. With ICS, you can tailor you design to make best use of both
world: asynchronous _AND_ multithreading.
Post by Martin James
The actual implications of this constraint are app-dependent. If the app.
does not perform any blocking ops, eg. 'simple routing', the effect is
minimal. When you have a lot of, say, database queries or file transfers,
then it becomes significant.
When you have database queries, it is much better to use a pool of worker
thread to execute database queries. This will allow you to have the best
number of database connections and have it independant of the TCP
connections. It is _NOT_ a good idea - for large systems - to have a
database connection for each TCP session. But again, if this is what you
want, ICS let you do it very easily !

--
Contribute to the SSL Effort. Visit
http://overbyte.delphicenter.com/eng/ssl.html
--
***@overbyte.be
Author of ICS (Internet Component Suite, freeware)
Author of MidWare (Multi-tier framework, freeware)
http://www.overbyte.be
Yahia El-Qasem
2003-07-15 22:42:02 UTC
Permalink
Please keep in mind when reading the following that this is not a rant on
Indy or ICS...

The only thing I am interested in is solving the problems we have with some
of our apps !

As I read this thread I am getting a clearer of what the problem with our
internal apps is :

We have multithreaded apps - every thread has FTP and TELNET client
component in SYNC mode AND 1 DB connection.
They run on a 1 GBit / s network ( previously 100 MBit / s ).
They move around big files with length of 1-2 GB via FTP.
They do sometimes lenghty queries in the DB.
They do execute some analytical code on those big files ( via Win32 memory
mapped files ).
They do use sometimes ActiveX objects with lengthy operations...


These apps are hanging sometimes - the hanging got more often when we
switched from 100MBit to 1 GBit network and when our files grew from
500 -1000 MB TO 1 -2 GB.
I was never able to reliably reproduce the problems - as far as I ever
traced it they hung in the message loop of ICS...

This happened with multi- and with singlethreaded apps.


This whole discussion leads me to the following conclusions about the
reasons for our apps to hang :

1. Sync mode of ICS is implemented by Async mode with some looping /
messages pump.

2. Async mode of ICS depends on the thread / app messages pump and is
therefore vulnerable if something goes wrong way with message pump / loop.

3. The messages loop gets sometimes in trouble when some of our lengthy
operations block too long


Solutions to our scenario :

a) With ICS : we would have to restructure our apps in a way that all
sockets operations are run in a separate thread from all lengthy
operations...

b) With Indy 9 / 10 : we would just have to reimplement the FTP / TELNET
abstraction layer in our apps with one based on Indy instead of ICS.



Please give me some feedback on the above thoughts...

Yahia
Post by Francois Piette
If you have some operation which has to wait (a blocking operation, not
an async operation), then you can always use a thread to execute it
without blocking. Without mention that you can always have a thread per
This requires you to determine EVERY operation that mnight block and break
it out. And its not only big operations like DB access, even smaller
operations have potential to block, but often dont. When the do -
bottleneck.
Threading individual pieces then just increases the complexity of the
system. Non blocking servers are ideal for file serving type applications,
but anytime logic or unpredictible "locks" are introduced they design
either falls apart or becomes quite complex.
Post by Francois Piette
But you _MUST_ always write use thread while with ICS you use a thread
only when required. Much less threads in the system. With Indy, you
_MUST_ have a thread per connection which is really overkill. With lot's
In most cases threads are sleeping and there is no over kill. Only after
1,000 is reached does any problem even begin to show.
Post by Francois Piette
of connections, your system will spend more time switching between
threads than doing actual processing. With ICS, you can tailor you
This is a fallacy Francois and you know it. Threads are only swtiched to
when they are active, and socket threads spend most of their time in sleep
states. So in a given pass maybe 50 from a thousand will be scheduled. And
even 1000 is nothing to a modern CPU. Divide 1 second by 1000, then factor
in 1GZ or more. Each thread will still have MANY MANY CPU cycles, in fact
many more than its quantum. Because of this even if EVERY thread was
active, and every thread got scheduled, because of the quantum each thread
would still get scheduled a very large number of times that second.
--
Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
"Programming is an art form that fights back"
Need extra help with an Indy problem?
http://www.atozedsoftware.com/indy/experts/support.html
ELKNews - Get your free copy at http://www.atozedsoftware.com
Francois Piette
2003-07-16 06:50:43 UTC
Permalink
Post by Yahia El-Qasem
They run on a 1 GBit / s network ( previously 100 MBit / s ).
The problem is not the speed of the line but the average data thruput. You
can have a 1 GBps line with an average thruput much less than that.
Post by Yahia El-Qasem
1. Sync mode of ICS is implemented by Async mode with some looping /
messages pump.
Yes it is.
Post by Yahia El-Qasem
2. Async mode of ICS depends on the thread / app messages pump and is
therefore vulnerable if something goes wrong way with message pump / loop.
You are right. No event is ever triggered if the message pump is not
working.
Post by Yahia El-Qasem
3. The messages loop gets sometimes in trouble when some of our lengthy
operations block too long
The message loop is stopped while ANY event is handled, no matter if it is a
lengthy or fast operation.
Post by Yahia El-Qasem
a) With ICS : we would have to restructure our apps in a way that all
sockets operations are run in a separate thread from all lengthy
operations...
That's what you have to do except if those operations are sequential with
reagd to the TCP stream. If you handle several TCP streams within a single
thread, then all blocking operation should be executed asynchronously in
their own "worker" thread.

The best design would be to implement a worker thread pool (let's say 50
threads) which will be used to execute lengthy operations. Augmenting the
number of thread would only make the whole thing slower and maybe cause
trouble with database connections (license problems, capabilities problem,
or performance problems).

--
Contribute to the SSL Effort. Visit
http://overbyte.delphicenter.com/eng/ssl.html
--
***@overbyte.be
Author of ICS (Internet Component Suite, freeware)
Author of MidWare (Multi-tier framework, freeware)
http://www.overbyte.be
Chad Z. Hower aka Kudzu
2003-07-16 20:51:21 UTC
Permalink
Post by Yahia El-Qasem
We have multithreaded apps - every thread has FTP and TELNET client
component in SYNC mode AND 1 DB connection.
You need to really think out your protocol very well. Indy will handle this -
but you are going to hit your own roadblocks long before Indy will if you
scale it up.



--
Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
"Programming is an art form that fights back"

Got Indy? Got the book?

http://www.atozedsoftware.com/indy/book/


ELKNews - Get your free copy at http://www.atozedsoftware.com

Maynard Philbrook
2003-07-14 00:48:29 UTC
Permalink
This post might be inappropriate. Click to display it.
Francois PIETTE
2003-07-13 14:56:01 UTC
Permalink
If you really need an opinion about ICS, you should ask in ICS support
mailing list where one thousand subscribers will share their knowledge with
you (but don't ask them anything about indy). To subscribe, please goto
http://www.elists.org/mailman/listinfo/twsocket
--
Contribute to the SSL Effort. Visit
http://overbyte.delphicenter.com/eng/ssl.html
--
***@overbyte.be
The author for the freeware multi-tier middleware MidWare
The author of the freeware Internet Component Suite (ICS)
http://www.overbyte.be
Post by Ted
I need some honest opinions about these two fine sets. My only experience
with them are some mini projects a year ago, nothing special just for
learning Delphi sockets.
Nowdays the company i work for, started some projects and asked from all the
developers, opinions on sockets delphi / BCB addin tools.
Generally speaking, i know the difference between them two, but i have no
further experience on their difficulty, support, stability and speed.
I'll appreciate any advice...
thanks
Ted
Loading...