G'Day - and a GPars question

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

G'Day - and a GPars question

apnakon
Hi Guys,

First up, I wanted to congratulate you all on a *great* piece of software!
GPars is quite awesome - I'm building a multi-threaded App that collects metric data across a large number
of Cisco switches and Linux servers (using Groovy and Java), and GPars is working like a dream.  The concept of stateful Actors is very nice.

Well done! :)

It amazes me that Java hasn't supplied a library like this long ago.  Do you think you might get GPars added to the main Java distro one day? ;)

I have a question, if I may.  What I'd like to be able to do, within my DefaultActor, is report on the size of the
message queue (and any other stats if I can get them!).  I have a look through the API but did not see an obvious way to
do this.  Also, re. messages, is their any limit to how large the message queue for an Actor can get?

Could you please let me know how I could do this.

Many Thanks,

Adrian.

=====================

Reply | Threaded
Open this post in threaded view
|

Re: G'Day - and a GPars question

Vaclav
Administrator
Hi Adrian,

thank you for your encouraging email. I'd be very happy if we could add your comment to the GPars User Voiced page http://gpars.codehaus.org/User+Voices


It amazes me that Java hasn't supplied a library like this long ago.  Do you think you might get GPars added to the main Java distro one day? ;)


As a matter of fact, GPars can be used from Java pretty well, however, we need a more aggressive release schedule than they have and so we tied ourselves to a more agile language ;)

I have a question, if I may.  What I'd like to be able to do, within my DefaultActor, is report on the size of the
message queue (and any other stats if I can get them!).  I have a look through the API but did not see an obvious way to
do this.  Also, re. messages, is their any limit to how large the message queue for an Actor can get?

ATM, it is not possible to query the size of the actors' message queues nor put an upper limit on them. In principal it should be possible to add them, although since the queues are highly optimized, the performance of the length detecting method is likely to be linear to the number of messages in the queue, provided we want to preserve the current memory and performance characteristics.

If you need this ability, please file a JIRA for us.

Regards,

Vaclav



Could you please let me know how I could do this.

Many Thanks,

Adrian.

=====================




--
E-mail: [hidden email]
Blog: http://www.jroller.com/vaclav
Linkedin page: http://www.linkedin.com/in/vaclavpech
Reply | Threaded
Open this post in threaded view
|

Re: G'Day - and a GPars question

Russel Winder
On Wed, 2011-06-01 at 21:37 +0200, Vaclav Pech wrote:
[ . . . ]

>        
>         I have a question, if I may.  What I'd like to be able to do,
>         within my DefaultActor, is report on the size of the
>         message queue (and any other stats if I can get them!).  I
>         have a look through the API but did not see an obvious way to
>         do this.  Also, re. messages, is their any limit to how large
>         the message queue for an Actor can get?
>        
>        
> ATM, it is not possible to query the size of the actors' message
> queues nor put an upper limit on them. In principal it should be
> possible to add them, although since the queues are highly optimized,
> the performance of the length detecting method is likely to be linear
> to the number of messages in the queue, provided we want to preserve
> the current memory and performance characteristics.
Making a note of caution explicit rather than implicity:  A length
calculation on a message queue in an actor system can only return a
lower bound on the number of items -- by the time the value is reported,
more messages could have been added.  

[ . . . ]


--
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

signature.asc (205 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

RE: G'Day - and a GPars question

apnakon
In reply to this post by Vaclav
Hi Vaclav (and Russel),

Thanks for your replies.

Yes - sure - you can use my comments.  Seems only fair I think!  ;)

I hope that you will continue work on GPars.  What plans do you have for it in the future?

Re. The size of the message queue.  To be honest, I wasn't after the exact count in a point in time as such, but more
a 'general indicator' on the depth.  Without knowing how you guys have implemented this (I'd love to know!), 
I appreciate that this could be quite a challenge in a threaded system that you want to keep as streamlined as possible.

Perhaps some simple sort of counter / decrementer system would work (++ for new message, -- for popped message)?

I was thinking about GPars messaging last night and another question occurred to me and I'd appreciate your input.

Imagine I have an Actor that is tasked to do database writes, and it has a few messages (each holding data) in its queue.
Now, if the Actor throws an Exception (say, on a failed DB connection), it would be very nice if I could take the
messages in its queue and redirect them to another Actor - or just be able to get at them.
Is this something that is possible?  If not, could I request it as well?

Thanks again,

Adrian.

=====================




Date: Wed, 1 Jun 2011 21:37:21 +0200
From: [hidden email]
To: [hidden email]
Subject: Re: [gpars-user] G'Day - and a GPars question

Hi Adrian,

thank you for your encouraging email. I'd be very happy if we could add your comment to the GPars User Voiced page http://gpars.codehaus.org/User+Voices


It amazes me that Java hasn't supplied a library like this long ago.  Do you think you might get GPars added to the main Java distro one day? ;)


As a matter of fact, GPars can be used from Java pretty well, however, we need a more aggressive release schedule than they have and so we tied ourselves to a more agile language ;)

I have a question, if I may.  What I'd like to be able to do, within my DefaultActor, is report on the size of the
message queue (and any other stats if I can get them!).  I have a look through the API but did not see an obvious way to
do this.  Also, re. messages, is their any limit to how large the message queue for an Actor can get?

ATM, it is not possible to query the size of the actors' message queues nor put an upper limit on them. In principal it should be possible to add them, although since the queues are highly optimized, the performance of the length detecting method is likely to be linear to the number of messages in the queue, provided we want to preserve the current memory and performance characteristics.

If you need this ability, please file a JIRA for us.

Regards,

Vaclav



Could you please let me know how I could do this.

Many Thanks,

Adrian.

=====================




--
E-mail: [hidden email]
Blog: http://www.jroller.com/vaclav
Linkedin page: http://www.linkedin.com/in/vaclavpech
Reply | Threaded
Open this post in threaded view
|

FW: [gpars-user] G'Day - and a GPars question

apnakon

Hi Vaclav (and Russel),

Thanks for your replies.

Yes - sure - you can use my comments.  Seems only fair I think!  ;)

I hope that you will continue work on GPars.  What plans do you have for it in the future?

Re. The size of the message queue.  To be honest, I wasn't after the exact count in a point in time as such, but more
a 'general indicator' on the depth.  Without knowing how you guys have implemented this (I'd love to know!), 
I appreciate that this could be quite a challenge in a threaded system that you want to keep as streamlined as possible.

Perhaps some simple sort of counter / decrementer system would work (++ for new message, -- for popped message)?

I was thinking about GPars messaging last night and another question occurred to me and I'd appreciate your input.

Imagine I have an Actor that is tasked to do database writes, and it has a few messages (each holding data) in its queue.
Now, if the Actor throws an Exception (say, on a failed DB connection), it would be very nice if I could take the
messages in its queue and redirect them to another Actor - or just be able to get at them.
Is this something that is possible?  If not, could I request it as well?

Thanks again,

Adrian.

=====================




Date: Wed, 1 Jun 2011 21:37:21 +0200
From: [hidden email]
To: [hidden email]
Subject: Re: [gpars-user] G'Day - and a GPars question

Hi Adrian,

thank you for your encouraging email. I'd be very happy if we could add your comment to the GPars User Voiced page http://gpars.codehaus.org/User+Voices


It amazes me that Java hasn't supplied a library like this long ago.  Do you think you might get GPars added to the main Java distro one day? ;)


As a matter of fact, GPars can be used from Java pretty well, however, we need a more aggressive release schedule than they have and so we tied ourselves to a more agile language ;)

I have a question, if I may.  What I'd like to be able to do, within my DefaultActor, is report on the size of the
message queue (and any other stats if I can get them!).  I have a look through the API but did not see an obvious way to
do this.  Also, re. messages, is their any limit to how large the message queue for an Actor can get?

ATM, it is not possible to query the size of the actors' message queues nor put an upper limit on them. In principal it should be possible to add them, although since the queues are highly optimized, the performance of the length detecting method is likely to be linear to the number of messages in the queue, provided we want to preserve the current memory and performance characteristics.

If you need this ability, please file a JIRA for us.

Regards,

Vaclav



Could you please let me know how I could do this.

Many Thanks,

Adrian.

=====================




--
E-mail: [hidden email]
Blog: http://www.jroller.com/vaclav
Linkedin page: http://www.linkedin.com/in/vaclavpech
Reply | Threaded
Open this post in threaded view
|

Re: G'Day - and a GPars question

Vaclav
Administrator
In reply to this post by apnakon
Adrian,

please see below.
 
I hope that you will continue work on GPars.  What plans do you have for it in the future?


The immediate plan is to release 0.12 and rush towards the 1.0 release, polishing the API and documentation along the way. Before we decide on how to continue after 1.0 we need to see more feedback from the users to evolve the bits that they would benefit from most.
 
Re. The size of the message queue.  To be honest, I wasn't after the exact count in a point in time as such, but more
a 'general indicator' on the depth.  Without knowing how you guys have implemented this (I'd love to know!), 
I appreciate that this could be quite a challenge in a threaded system that you want to keep as streamlined as possible.

It is actually a pretty compact piece of code. You can check it out at https://github.com/vaclav/GPars/blob/master/src/main/groovy/groovyx/gpars/util/DefaultMessageQueue.java and https://github.com/vaclav/GPars/blob/master/src/main/groovy/groovyx/gpars/util/AsyncMessagingCore.java.
It took me quite a while to tune it so that we don't lock unnecessarily.

Perhaps some simple sort of counter / decrementer system would work (++ for new message, -- for popped message)?

I'll see whether something can be added without performance impact on the core messaging functionality.
 
I was thinking about GPars messaging last night and another question occurred to me and I'd appreciate your input.

Imagine I have an Actor that is tasked to do database writes, and it has a few messages (each holding data) in its queue.
Now, if the Actor throws an Exception (say, on a failed DB connection), it would be very nice if I could take the
messages in its queue and redirect them to another Actor - or just be able to get at them.
Is this something that is possible?  If not, could I request it as well?

I believe the lifecycle methods could help you get this done:
        actor.metaClass {
            onException = {exception -> ... }
            afterStop = {List undeliveredMessages -> ... }
        }

 
Cheers,

Vaclav


--
E-mail: [hidden email]
Blog: http://www.jroller.com/vaclav
Linkedin page: http://www.linkedin.com/in/vaclavpech