Yes,  each thread has its own stack and on some versions of delphi the
thread stack size defaulted to 2mb I believe,  that's what I mean by stack
memory.  You can specify a thread stack size on free pascal,  but you still
have to be careful you can't set it to small or you will have issues.
Single threaded or a few threads doing select has none of these issues.
Not to mention thread context swaps get expensive as well,  though that is
minimized a bit with multiple cores.   You also minimize the use of
critical sections.  Just my thoughts on the matter.
On Mar 2, 2012 8:43 AM, "Jorge Aldo G. de F. Junior" <jagf...@gmail.com>
wrote:

> How much more memory ?
>
> I believe 8gb memory is quite cheap (hardware is always cheaper than
> software) for such a specific task.
>
> Each thread has his own stack so i dont understand what you mean by
> "using stack memory".
>
> Of course each thread adds more memory space, but this must not be
> much noticeable.
>
> You can try the following :
>
> 1 - a thread waits for new TCP/IP connections and puts into the queue
> of a load balance thread.
> 2 - a second thread acts like load balancer.
> 3 - a bunch of worker threads that waits for a new message (a socket)
> to act into, after working, they put the socket back into the load
> balancer queue.
>
> that way you wont be creating/destroying threads all the time.
>
> 2012/3/2 Tony Caduto <tony.cad...@gmail.com>:
> > I have a one thread per connection version and it works fine,  however it
> > uses a lot more memory,  not to mention all the threads use up stack
> space
> > and then there are memory manager issues with threads. I am not convinced
> > one thread per connection is going to scale well for something like a
> > instant message server where you have lots of long term connections that
> sit
> > idle most of the time.
> > I could also use a thread pool with each one handling 64 connections.
> > The other thing is while using select might be slower I don't think it
> would
> > be noticeable to users because of network latency.
> >
> > On Mar 2, 2012 8:23 AM, "Jorge Aldo G. de F. Junior" <jagf...@gmail.com>
> > wrote:
> >>
> >> It WILL be slower.
> >>
> >> One thread per connection scales very well on multiple core systems.
> >>
> >> While a single thread wont scale.
> >>
> >> If you are having trouble dealing with multithreaded programming you
> >> might look at my Pascal Actor Model framework that makes use of queues
> >> to allow easy communication between actors (threads)
> >>
> >> 2012/3/2 Tony Caduto <tony.cad...@gmail.com>:
> >> > Wow,  windows sucks :-),
> >> > What if I do my own select by keeping a list of tsockets and loop
> >> > through
> >> > and use canread on each one,  I can't imagine it would be much slower
> on
> >> > a
> >> > modern server with a fast cpu and multiple cores.
> >> > I did read on Google of people raising fd_setsize past 64 on newer
> >> > windows
> >> > servers is and win 7 and it worked.
> >> >
> >> > On Mar 1, 2012 3:10 PM, "Lukas Gebauer" <gebyl...@mlp.cz> wrote:
> >> >>
> >> >> > I was looking in sswin32.inc and the fd_setsize const is 64 and in
> >> >> > sslinux.inc it's 1024
> >> >> >
> >> >> > Why is the win32 FD_SETSIZE const only 64?
> >> >>
> >> >> See: http://tangentsoft.net/wskfaq/advanced.html
> >> >> chapter 4.9
> >> >>
> >> >>
> >> >> --
> >> >> Lukas Gebauer.
> >> >>
> >> >> http://synapse.ararat.cz/ - Synapse Delphi and Kylix TCP/IP Library
> >> >> http://geoget.ararat.cz/ - Geocaching solution
> >> >>
> >> >>
> >> >>
> >> >>
> >> >>
> >> >>
> ------------------------------------------------------------------------------
> >> >> Virtualization & Cloud Management Using Capacity Planning
> >> >> Cloud computing makes use of virtualization - but cloud computing
> >> >> also focuses on allowing computing to be delivered as a service.
> >> >> http://www.accelacomm.com/jaw/sfnl/114/51521223/
> >> >> _______________________________________________
> >> >> synalist-public mailing list
> >> >> synalist-public@lists.sourceforge.net
> >> >> https://lists.sourceforge.net/lists/listinfo/synalist-public
> >> >
> >> >
> >> >
> >> >
> ------------------------------------------------------------------------------
> >> > Virtualization & Cloud Management Using Capacity Planning
> >> > Cloud computing makes use of virtualization - but cloud computing
> >> > also focuses on allowing computing to be delivered as a service.
> >> > http://www.accelacomm.com/jaw/sfnl/114/51521223/
> >> > _______________________________________________
> >> > synalist-public mailing list
> >> > synalist-public@lists.sourceforge.net
> >> > https://lists.sourceforge.net/lists/listinfo/synalist-public
> >> >
> >>
> >>
> >>
> ------------------------------------------------------------------------------
> >> Virtualization & Cloud Management Using Capacity Planning
> >> Cloud computing makes use of virtualization - but cloud computing
> >> also focuses on allowing computing to be delivered as a service.
> >> http://www.accelacomm.com/jaw/sfnl/114/51521223/
> >> _______________________________________________
> >> synalist-public mailing list
> >> synalist-public@lists.sourceforge.net
> >> https://lists.sourceforge.net/lists/listinfo/synalist-public
> >
> >
> >
> ------------------------------------------------------------------------------
> > Virtualization & Cloud Management Using Capacity Planning
> > Cloud computing makes use of virtualization - but cloud computing
> > also focuses on allowing computing to be delivered as a service.
> > http://www.accelacomm.com/jaw/sfnl/114/51521223/
> > _______________________________________________
> > synalist-public mailing list
> > synalist-public@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/synalist-public
> >
>
>
> ------------------------------------------------------------------------------
> Virtualization & Cloud Management Using Capacity Planning
> Cloud computing makes use of virtualization - but cloud computing
> also focuses on allowing computing to be delivered as a service.
> http://www.accelacomm.com/jaw/sfnl/114/51521223/
> _______________________________________________
> synalist-public mailing list
> synalist-public@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/synalist-public
>
------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
synalist-public mailing list
synalist-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/synalist-public

Reply via email to