GPars newbie

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

GPars newbie

anon
Hello list,
would need some advices regarding the use of gpars primitives for
parallel socket io operations. What I mean is that I would like to
simulate thousands of concurrent clients connecting to a server using
long lived socket connections. I am tempted to use actors but I am not
sure what happens when 1000 actors are reading simultaneously on their
respective socket. Is the current running thread going to block until
the actor yields/returns? What is going to happen. How would you guys
implement it with gpars?
Thanks.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: GPars newbie

Russel Winder-3
On Wed, 2014-07-09 at 19:14 +0200, anon wrote:

> Hello list,
> would need some advices regarding the use of gpars primitives for
> parallel socket io operations. What I mean is that I would like to
> simulate thousands of concurrent clients connecting to a server using
> long lived socket connections. I am tempted to use actors but I am not
> sure what happens when 1000 actors are reading simultaneously on their
> respective socket. Is the current running thread going to block until
> the actor yields/returns? What is going to happen. How would you guys
> implement it with gpars?
> Thanks.

If you use GPars actors for modelling this (and this seems like a
reasonable idea to me) then it is important to realize that they are
built over a thread pool not a single threaded event loop. Thus there
are as many threads as you want animating the actor system and things
like actor message processing are not dependent on any notion of yield.

It is invariably best to make your actors single threaded, not only is
the right thing to do from a theoretical perspective, it is also the
best way of allowing the thread pool to work as efficiently as possible.

--
Russel.
=============================================================================
Dr Russel Winder      t: +44 20 7585 2200   voip: sip:[hidden email]
41 Buckmaster Road    m: +44 7770 465 077   xmpp: [hidden email]
London SW11 1EN, UK   w: www.russel.org.uk  skype: russel_winder


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: GPars newbie

Russel Winder-3
In reply to this post by anon
On Wed, 2014-07-09 at 19:14 +0200, anon wrote:

> Hello list,
> would need some advices regarding the use of gpars primitives for
> parallel socket io operations. What I mean is that I would like to
> simulate thousands of concurrent clients connecting to a server using
> long lived socket connections. I am tempted to use actors but I am not
> sure what happens when 1000 actors are reading simultaneously on their
> respective socket. Is the current running thread going to block until
> the actor yields/returns? What is going to happen. How would you guys
> implement it with gpars?
> Thanks.

If you use GPars actors for modelling this (and this seems like a
reasonable idea to me) then it is important to realize that they are
built over a thread pool not a single threaded event loop. Thus there
are as many threads as you want animating the actor system and things
like actor message processing are not dependent on any notion of yield.

It is invariably best to make your actors single threaded, not only is
the right thing to do from a theoretical perspective, it is also the
best way of allowing the thread pool to work as efficiently as possible.

--
Russel.
=============================================================================
Dr Russel Winder      t: +44 20 7585 2200   voip: sip:[hidden email]
41 Buckmaster Road    m: +44 7770 465 077   xmpp: [hidden email]
London SW11 1EN, UK   w: www.russel.org.uk  skype: russel_winder


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: GPars newbie

anon
Good advices I might say.  Thank you for the detailded explanation.
That's exactly what I intend to do.


On 10.07.2014 11:48, Russel Winder wrote:

> On Wed, 2014-07-09 at 19:14 +0200, anon wrote:
>> Hello list,
>> would need some advices regarding the use of gpars primitives for
>> parallel socket io operations. What I mean is that I would like to
>> simulate thousands of concurrent clients connecting to a server using
>> long lived socket connections. I am tempted to use actors but I am not
>> sure what happens when 1000 actors are reading simultaneously on their
>> respective socket. Is the current running thread going to block until
>> the actor yields/returns? What is going to happen. How would you guys
>> implement it with gpars?
>> Thanks.
> If you use GPars actors for modelling this (and this seems like a
> reasonable idea to me) then it is important to realize that they are
> built over a thread pool not a single threaded event loop. Thus there
> are as many threads as you want animating the actor system and things
> like actor message processing are not dependent on any notion of yield.
>
> It is invariably best to make your actors single threaded, not only is
> the right thing to do from a theoretical perspective, it is also the
> best way of allowing the thread pool to work as efficiently as possible.
>


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email