Akka actors for performance

241 views
Skip to first unread message

Daniel Ribeiro

unread,
Dec 15, 2010, 8:54:36 PM12/15/10
to Akka User List
Hi,

I've been playing around with akka actors to simulate a map-reduce
chain, as mentioned on a former post[1], and I've seen decreased
performance. Even with work stealing dispatchers. I was using it in
quite an unusual way, but ended up re-implementing it in Java, and saw
the same pattern. Is there a example for using akka actors for
increasing perfromance?

Cheers,
- Daniel Ribeiro


[1] http://groups.google.com/group/akka-user/browse_thread/thread/b9d4d7ac537e6582

√iktor Klang

unread,
Dec 16, 2010, 4:11:22 AM12/16/10
to akka...@googlegroups.com
On Thu, Dec 16, 2010 at 2:54 AM, Daniel Ribeiro <dan...@gmail.com> wrote:
Hi,

I've been playing around with akka actors to simulate a map-reduce
chain, as mentioned on a former post[1], and I've seen decreased
performance.

What's the bottleneck?
 
Even with work stealing dispatchers.

Se above question.
 
I was using it in
quite an unusual way, but ended up re-implementing it in Java, and saw
the same pattern.

Same pattern? Low performance? "Implement in Java"<- what does that mean? Implemented how and using what?
 
Is there a example for using akka actors for
increasing perfromance?

Increasing performance of what? How parallelizable is your problem domain, what dispatcher-settings are you using, are you doing any blocking operations? Do you allocate proper amounts of memory to the VMs? What settings do you have for the VM? What version of the VM are you using? What OS are you deploying to?
 

--
You received this message because you are subscribed to the Google Groups "Akka User List" group.
To post to this group, send email to akka...@googlegroups.com.
To unsubscribe from this group, send email to akka-user+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/akka-user?hl=en.




--
Viktor Klang,
Code Connoisseur
Work:   Scalable Solutions
Code:   github.com/viktorklang
Follow: twitter.com/viktorklang
Read:   klangism.tumblr.com

Peter Veentjer

unread,
Dec 16, 2010, 4:25:20 AM12/16/10
to akka...@googlegroups.com
The efficiency of the actors framework has a direct connection to the size of the chunks that are processed in the map/reduce algorithm. If it is too fine grained, the overhead  will be bigger than the performance benefit. The same goes for the FJ-framework or Intel thread building blocks.

My first go would be to hook in with a Profiler (I have very good experience with JProfiler and Intel VTune) to get a clue what is happening.

If you are doing very fine grained stuff and creating millions of objects directly (or indirectly.. e.g. by the linkedblockingqueue that is used for the mailbox), it will kill any form of scalability.

Check the following graph:


It shows what happens when no object is created or just a single object caused by boxing.

Daniel Ribeiro

unread,
Dec 16, 2010, 8:08:37 AM12/16/10
to Akka User List
@Viktor
I had mentioned the specifics the linked post (except for machine
stats). But it did not really matter as @Peter Veentjer's suggestion
did the trick. Thanks again for the interest.

@Peter Veentjer
Very nice suggestion. I tried parameterizing grain size (so simple it
didn't even add one line of code), and using coarser grains. Worked
Great. From being slower than the iterative form, it became 30% faster
(needs some fine tuning, of course) in a machine with two cores (and
thanks to workStealer dispatcher).

I am writing a post about akka used in an unconventional way (all the
code in question will be on github shortly), and the performance boost
was just a cherry on top of the ice cream. But a welcomed one.

Thanks all for the help,
- Daniel Ribeiro


On Dec 16, 7:25 am, Peter Veentjer <alarmnum...@gmail.com> wrote:
> The efficiency of the actors framework has a direct connection to the size
> of the chunks that are processed in the map/reduce algorithm. If it is too
> fine grained, the overhead  will be bigger than the performance benefit. The
> same goes for the FJ-framework or Intel thread building blocks.
>
> My first go would be to hook in with a Profiler (I have very good experience
> with JProfiler and Intel VTune) to get a clue what is happening.
>
> If you are doing very fine grained stuff and creating millions of objects
> directly (or indirectly.. e.g. by the linkedblockingqueue that is used for
> the mailbox), it will kill any form of scalability.
>
> Check the following graph:
>
> http://git.codehaus.org/gitweb.cgi?p=multiverse.git;a=blob;f=charts/b...
>
> <http://git.codehaus.org/gitweb.cgi?p=multiverse.git;a=blob;f=charts/b...>It
> shows what happens when no object is created or just a single object caused
> by boxing.
>
> On Thu, Dec 16, 2010 at 10:11 AM, √iktor Klang <viktor.kl...@gmail.com>wrote:
>
>
>
> > On Thu, Dec 16, 2010 at 2:54 AM, Daniel Ribeiro <dan...@gmail.com> wrote:
>
> >> Hi,
>
> >> I've been playing around with akka actors to simulate a map-reduce
> >> chain, as mentioned on a former post[1], and I've seen decreased
> >> performance.
>
> > What's the bottleneck?
>
> >> Even with work stealing dispatchers.
>
> > Se above question.
>
> >> I was using it in
> >> quite an unusual way, but ended up re-implementing it in Java, and saw
> >> the same pattern.
>
> > Same pattern? Low performance? "Implement in Java"<- what does that mean?
> > Implemented how and using what?
>
> >> Is there a example for using akka actors for
> >> increasing perfromance?
>
> > Increasing performance of what? How parallelizable is your problem domain,
> > what dispatcher-settings are you using, are you doing any blocking
> > operations? Do you allocate proper amounts of memory to the VMs? What
> > settings do you have for the VM? What version of the VM are you using? What
> > OS are you deploying to?
>
> >> Cheers,
> >> - Daniel Ribeiro
>
> >> [1]
> >>http://groups.google.com/group/akka-user/browse_thread/thread/b9d4d7a...
>
> >> --
> >> You received this message because you are subscribed to the Google Groups
> >> "Akka User List" group.
> >> To post to this group, send email to akka...@googlegroups.com.
> >> To unsubscribe from this group, send email to
> >> akka-user+...@googlegroups.com<akka-user%2Bunsu...@googlegroups.com>
> >> .
> >> For more options, visit this group at
> >>http://groups.google.com/group/akka-user?hl=en.
>
> > --
> > Viktor Klang,
> > Code Connoisseur
> > Work:   Scalable Solutions <http://www.scalablesolutions.se>
> > Code:   github.com/viktorklang
> > Follow: twitter.com/viktorklang
> > Read:   klangism.tumblr.com
>
> >  --
> > You received this message because you are subscribed to the Google Groups
> > "Akka User List" group.
> > To post to this group, send email to akka...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > akka-user+...@googlegroups.com<akka-user%2Bunsu...@googlegroups.com>
> > .

√iktor Klang

unread,
Dec 16, 2010, 8:10:52 AM12/16/10
to akka...@googlegroups.com
On Thu, Dec 16, 2010 at 2:08 PM, Daniel Ribeiro <dan...@gmail.com> wrote:
@Viktor
I had mentioned the specifics the linked post (except for machine
stats). But it did not really matter as @Peter Veentjer's suggestion
did the trick. Thanks again for the interest.

@Peter Veentjer
Very nice suggestion. I tried parameterizing grain size (so simple it
didn't even add one line of code), and using coarser grains. Worked
Great. From being slower than the iterative form, it became 30% faster
(needs some fine tuning, of course) in a machine with two cores (and
thanks to workStealer dispatcher).

I am writing a post about akka used in an unconventional way (all the
code in question will be on github shortly), and the performance boost
was just a cherry on top of the ice cream. But a welcomed one.

Great to hear, have fun!
 
To unsubscribe from this group, send email to akka-user+...@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/akka-user?hl=en.




--
Viktor Klang,
Code Connoisseur
Work:   Scalable Solutions

Daniel Ribeiro

unread,
Dec 16, 2010, 8:57:46 PM12/16/10
to Akka User List
Thanks. It was a blast. I've written about my experiences with akka
here: http://bit.ly/g7DDha
> > <akka-user%2Bunsu...@googlegroups.com<akka-user%252Buns...@googlegroups.com>
>
> > > >> .
> > > >> For more options, visit this group at
> > > >>http://groups.google.com/group/akka-user?hl=en.
>
> > > > --
> > > > Viktor Klang,
> > > > Code Connoisseur
> > > > Work:   Scalable Solutions <http://www.scalablesolutions.se>
> > > > Code:   github.com/viktorklang
> > > > Follow: twitter.com/viktorklang
> > > > Read:   klangism.tumblr.com
>
> > > >  --
> > > > You received this message because you are subscribed to the Google
> > Groups
> > > > "Akka User List" group.
> > > > To post to this group, send email to akka...@googlegroups.com.
> > > > To unsubscribe from this group, send email to
> > > > akka-user+...@googlegroups.com<akka-user%2Bunsu...@googlegroups.com>
> > <akka-user%2Bunsu...@googlegroups.com<akka-user%252Buns...@googlegroups.com>
>
> > > > .
> > > > For more options, visit this group at
> > > >http://groups.google.com/group/akka-user?hl=en.
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Akka User List" group.
> > To post to this group, send email to akka...@googlegroups.com.
> > To unsubscribe from this group, send email to

Jonas Bonér

unread,
Dec 17, 2010, 2:37:09 AM12/17/10
to akka...@googlegroups.com
Great. Thanks for the write-up. 

To unsubscribe from this group, send email to akka-user+...@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/akka-user?hl=en.




--
Jonas Bonér

Specialist at Large
work: http://scalablesolutions.se
code: http://akka.io
blog: http://jonasboner.com
twtr: @jboner



√iktor Klang

unread,
Dec 17, 2010, 3:53:52 AM12/17/10
to akka...@googlegroups.com
On Fri, Dec 17, 2010 at 2:57 AM, Daniel Ribeiro <dan...@gmail.com> wrote:
Thanks. It was a blast. I've written about my experiences with akka
here: http://bit.ly/g7DDha


Cool! Great write up :-) !

just FYI: there's no AOP involved in UntypedActor, it's only for TypedActor.
 
To unsubscribe from this group, send email to akka-user+...@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/akka-user?hl=en.




--
Viktor Klang,
Code Connoisseur
Work:   Scalable Solutions

Daniel Ribeiro

unread,
Dec 17, 2010, 11:26:13 AM12/17/10
to Akka User List
Thanks. Weird that there's no AOP. It really doesn't work without the
create method on classes. Guess it would need more akka source
searching to find out the real reason then...

Regards, and keep up the great work.
- Daniel Ribeiro
> > > > <akka-user%2Bunsu...@googlegroups.com<akka-user%252Buns...@googlegroups.com>
> > <akka-user%252Buns...@googlegroups.com<akka-user%25252Bun...@googlegroups.com>
>
> > > > > >> .
> > > > > >> For more options, visit this group at
> > > > > >>http://groups.google.com/group/akka-user?hl=en.
>
> > > > > > --
> > > > > > Viktor Klang,
> > > > > > Code Connoisseur
> > > > > > Work:   Scalable Solutions <http://www.scalablesolutions.se>
> > > > > > Code:   github.com/viktorklang
> > > > > > Follow: twitter.com/viktorklang
> > > > > > Read:   klangism.tumblr.com
>
> > > > > >  --
> > > > > > You received this message because you are subscribed to the Google
> > > > Groups
> > > > > > "Akka User List" group.
> > > > > > To post to this group, send email to akka...@googlegroups.com.
> > > > > > To unsubscribe from this group, send email to
> > > > > > akka-user+...@googlegroups.com<akka-user%2Bunsu...@googlegroups.com>
> > <akka-user%2Bunsu...@googlegroups.com<akka-user%252Buns...@googlegroups.com>
>
> > > > <akka-user%2Bunsu...@googlegroups.com<akka-user%252Buns...@googlegroups.com>
> > <akka-user%252Buns...@googlegroups.com<akka-user%25252Bun...@googlegroups.com>
>
> > > > > > .
> > > > > > For more options, visit this group at
> > > > > >http://groups.google.com/group/akka-user?hl=en.
>
> > > > --
> > > > You received this message because you are subscribed to the Google
> > Groups
> > > > "Akka User List" group.
> > > > To post to this group, send email to akka...@googlegroups.com.
> > > > To unsubscribe from this group, send email to
> > > > akka-user+...@googlegroups.com<akka-user%2Bunsu...@googlegroups.com>

√iktor Klang

unread,
Dec 17, 2010, 11:29:12 AM12/17/10
to akka...@googlegroups.com
On Fri, Dec 17, 2010 at 5:26 PM, Daniel Ribeiro <dan...@gmail.com> wrote:
Thanks. Weird that there's no AOP. It really doesn't work without the
create method on classes.

The create-method is needed because that's the method on ActorFactory that creates an instance of the actor, a SAM-type to overcome Java's lack of closures.
 
Guess it would need more akka source
searching to find out the real reason then...

Regards, and keep up the  great work.

You too!
 
To unsubscribe from this group, send email to akka-user+...@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/akka-user?hl=en.




--
Viktor Klang,
Code Connoisseur
Work:   Scalable Solutions

Derek Williams

unread,
Dec 17, 2010, 11:41:47 AM12/17/10
to akka...@googlegroups.com
On Thu, Dec 16, 2010 at 6:57 PM, Daniel Ribeiro <dan...@gmail.com> wrote:
> Thanks. It was a blast. I've written about my experiences with akka
> here: http://bit.ly/g7DDha

Nice write up. I tried doing this with my little project of using
scalaz with futures as it seems like a good, cpu intensive task (at
least once the file is loaded in). I couldn't get jruby working right
on my system to try out your implementation, how many unique words
should be found? This will let me know I'm not doing something wrong.

FYI, I have to increase the work size quite a bit more to reach the
same performance as having dedicated actors (about 10000 lines per
job), so I'm wasting too much CPU time managing actors. When I try
doing 500 line chunks I end up timing out my actors (with a 30 second
timeout set), so good job with that!

--
Derek

Daniel Ribeiro

unread,
Dec 17, 2010, 5:58:25 PM12/17/10
to Akka User List
Thanks Derek. I did not quite understand the issue, and if you
eventually did work out your jruby or not (I guess you did, as you
mention your experiments on the last paragraph). If I understood
correctly, you are looking for something like this (just uploaded):
https://github.com/danielribeiro/RubyOnAkka/blob/master/output

This file contains all the word/count pairs on the shakespeare file.
About increasing the lines: yeah, you probably have a faster pc than
mine. You can also increase the number of map actor on line 31 of the
actor_word_count.rb (https://github.com/danielribeiro/RubyOnAkka/blob/
master/lib/actor_word_count.rb#L31)

Different machines I guess. But hope you had fun, and I addressed the
issues.

Regards,
- Daniel

Peter Veentjer

unread,
Dec 17, 2010, 6:06:18 PM12/17/10
to akka...@googlegroups.com
If you send me a zip containing a bash script that runs the whole stuff without me configuring anything (except some basic stuff like threadcount/chunksize), I can run it on an 8 core machine for the both of you.

I can even have a peek with it using VTune and see where the bottleneck is.

--
You received this message because you are subscribed to the Google Groups "Akka User List" group.
To post to this group, send email to akka...@googlegroups.com.
To unsubscribe from this group, send email to akka-user+...@googlegroups.com.

Derek Williams

unread,
Dec 17, 2010, 7:01:16 PM12/17/10
to akka...@googlegroups.com
Sorry for not being more clear, I'm just fooling around with an
implementation of the same algorithm on Scala. I just wanted to make
sure my results were the same as your own since I wasn't able to get
yours running. I'll check out that file and see if they match up.

I did find the issue in my algorithm, I was reducing the wrong way :)
I kept on folding the larger result onto the smaller. Fixed that up
and I've got it running good now. I'm including it as a test on my
akka-scalaz project (http://github.com/derekjw/akka-scalaz).

If you are curious it is the last test in this file:
https://github.com/derekjw/akka-scalaz/blob/master/src/test/scala/FuturesSpec.scala

> --
> You received this message because you are subscribed to the Google Groups "Akka User List" group.
> To post to this group, send email to akka...@googlegroups.com.

> To unsubscribe from this group, send email to akka-user+...@googlegroups.com.


> For more options, visit this group at http://groups.google.com/group/akka-user?hl=en.
>
>

--
Derek

Daniel Ribeiro

unread,
Dec 19, 2010, 5:37:58 PM12/19/10
to Akka User List
@Peter,

Just pushed a new version, with benchmark.sh (you can download at
https://github.com/danielribeiro/RubyOnAkka/zipball/master):
https://github.com/danielribeiro/RubyOnAkka/blob/master/benchmark.sh

As long as you have jruby and rake (which comes with jruby), you can
start it like:
$ benchmark.sh chunkSize and mapActorsCount

You may want to grep the output, like
$ benchmark.sh chunkSize and mapActorsCount 2>&1 | grep 'Total time:'

Please, let me know If you need any help.

@Derek
There is a java implementation of the wordcount class:
https://github.com/danielribeiro/RubyOnAkka/blob/master/java/mapreduce/WordCount.java

It passes the same specs the JRuby version does:
https://github.com/danielribeiro/RubyOnAkka/blob/master/spec/word_count_spec.rb

Cheers,
- Daniel

On Dec 17, 10:01 pm, Derek Williams <de...@nebvin.ca> wrote:
> Sorry for not being more clear, I'm just fooling around with an
> implementation of the same algorithm on Scala. I just wanted to make
> sure my results were the same as your own since I wasn't able to get
> yours running. I'll check out that file and see if they match up.
>
> I did find the issue in my algorithm, I was reducing the wrong way :)
> I kept on folding the larger result onto the smaller. Fixed that up
> and I've got it running good now. I'm including it as a test on my
> akka-scalaz project (http://github.com/derekjw/akka-scalaz).
>
> If you are curious it is the last test in this file:https://github.com/derekjw/akka-scalaz/blob/master/src/test/scala/Fut...

Peter Veentjer

unread,
Dec 19, 2010, 5:50:02 PM12/19/10
to akka...@googlegroups.com
Hi Daniel,

what is a good chunkSize/mapActors count? I haver 12 gigs of ram and 8 real processors.

Peter Veentjer

unread,
Dec 19, 2010, 6:00:33 PM12/19/10
to akka...@googlegroups.com
I get the following error while executing the benchmark:

alarmnummer@alarmnummer-desktop:~/danielribeiro-RubyOnAkka-b5a027a$ ./benchmark.sh 1 1
warning: could not compile; pass -d or -J-Djruby.jit.logging.verbose=true for more details
(in /home/alarmnummer/danielribeiro-RubyOnAkka-b5a027a)
/java/tools/jruby-1.5.6/lib/ruby/site_ruby/shared/builtin/javasupport/core_ext/module.rb:42:in `const_missing': UntypedActor not found in packages se.scalablesolutions.akka.actor; last error: cannot load Java class se.scalablesolutions.akka.actor.UntypedActor (NameError)
    from /home/alarmnummer/danielribeiro-RubyOnAkka-b5a027a/lib/akka.rb:7
    from /home/alarmnummer/danielribeiro-RubyOnAkka-b5a027a/lib/akka.rb:1:in `require'
    from lib/benchmarking_akka.rb:1

Daniel Ribeiro

unread,
Dec 19, 2010, 6:01:27 PM12/19/10
to Akka User List
The default I've been using is 500/2

Adding many actors on my 2 core pc actually make it go slower,
specially after 4 actors.


lib/shakespeare.txt has 124456 liness, which is important when going
really overblown with chuncSizes (anything higher than 124456/
mapActors as chunksize will probably hurt performance)

[]


On Dec 19, 8:50 pm, Peter Veentjer <alarmnum...@gmail.com> wrote:
> Hi Daniel,
>
> what is a good chunkSize/mapActors count? I haver 12 gigs of ram and 8 real
> processors.
>
> On Sun, Dec 19, 2010 at 11:37 PM, Daniel Ribeiro <dan...@gmail.com> wrote:
> > @Peter,
>
> > Just pushed a new version, with benchmark.sh (you can download at
> >https://github.com/danielribeiro/RubyOnAkka/zipball/master):
> >https://github.com/danielribeiro/RubyOnAkka/blob/master/benchmark.sh
>
> > As long as you have jruby and rake (which comes with jruby), you can
> > start it like:
> > $ benchmark.sh chunkSize and mapActorsCount
>
> > You may want to grep the output, like
> > $ benchmark.sh chunkSize and mapActorsCount 2>&1 | grep 'Total time:'
>
> > Please, let me know If you need any help.
>
> > @Derek
> > There is a java implementation of the wordcount class:
>
> >https://github.com/danielribeiro/RubyOnAkka/blob/master/java/mapreduc...
>
> > It passes the same specs the JRuby version does:
>
> >https://github.com/danielribeiro/RubyOnAkka/blob/master/spec/word_cou...
> > akka-user+...@googlegroups.com<akka-user%2Bunsu...@googlegroups.com>
> > .
> > > > For more options, visit this group athttp://
> > groups.google.com/group/akka-user?hl=en.
>
> > > --
> > > Derek
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Akka User List" group.
> > To post to this group, send email to akka...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > akka-user+...@googlegroups.com<akka-user%2Bunsu...@googlegroups.com>
> > .

Daniel Ribeiro

unread,
Dec 19, 2010, 6:03:30 PM12/19/10
to Akka User List
Ah, you need to execute it on the same folder of the project. It uses
relative paths so that it works anywhere. The error you got is because
it could not find the vendor folder, with the required jars.

If typing rake on the folder of the project doesn't work, then it is
more serious...

On Dec 19, 9:00 pm, Peter Veentjer <alarmnum...@gmail.com> wrote:
> I get the following error while executing the benchmark:
>
> alarmnummer@alarmnummer-desktop:~/danielribeiro-RubyOnAkka-b5a027a$
> ./benchmark.sh 1 1
> warning: could not compile; pass -d or -J-Djruby.jit.logging.verbose=true
> for more details
> (in /home/alarmnummer/danielribeiro-RubyOnAkka-b5a027a)
> /java/tools/jruby-1.5.6/lib/ruby/site_ruby/shared/builtin/javasupport/core_ext/module.rb:42:in
> `const_missing': UntypedActor not found in packages
> se.scalablesolutions.akka.actor; last error: cannot load Java class
> se.scalablesolutions.akka.actor.UntypedActor (NameError)
>     from /home/alarmnummer/danielribeiro-RubyOnAkka-b5a027a/lib/akka.rb:7
>     from /home/alarmnummer/danielribeiro-RubyOnAkka-b5a027a/lib/akka.rb:1:in
> `require'
>     from lib/benchmarking_akka.rb:1
>
> On Sun, Dec 19, 2010 at 11:50 PM, Peter Veentjer <alarmnum...@gmail.com>wrote:
>
> > Hi Daniel,
>
> > what is a good chunkSize/mapActors count? I haver 12 gigs of ram and 8 real
> > processors.
>
> > On Sun, Dec 19, 2010 at 11:37 PM, Daniel Ribeiro <dan...@gmail.com> wrote:
>
> >> @Peter,
>
> >> Just pushed a new version, with benchmark.sh (you can download at
> >>https://github.com/danielribeiro/RubyOnAkka/zipball/master):
> >>https://github.com/danielribeiro/RubyOnAkka/blob/master/benchmark.sh
>
> >> As long as you have jruby and rake (which comes with jruby), you can
> >> start it like:
> >> $ benchmark.sh chunkSize and mapActorsCount
>
> >> You may want to grep the output, like
> >> $ benchmark.sh chunkSize and mapActorsCount 2>&1 | grep 'Total time:'
>
> >> Please, let me know If you need any help.
>
> >> @Derek
> >> There is a java implementation of the wordcount class:
>
> >>https://github.com/danielribeiro/RubyOnAkka/blob/master/java/mapreduc...
>
> >> It passes the same specs the JRuby version does:
>
> >>https://github.com/danielribeiro/RubyOnAkka/blob/master/spec/word_cou...
> >> akka-user+...@googlegroups.com<akka-user%2Bunsu...@googlegroups.com>
> >> .
> >> > > For more options, visit this group athttp://
> >> groups.google.com/group/akka-user?hl=en.
>
> >> > --
> >> > Derek
>
> >> --
> >> You received this message because you are subscribed to the Google Groups
> >> "Akka User List" group.
> >> To post to this group, send email to akka...@googlegroups.com.
> >> To unsubscribe from this group, send email to
> >> akka-user+...@googlegroups.com<akka-user%2Bunsu...@googlegroups.com>
> >> .

Peter Veentjer

unread,
Dec 19, 2010, 6:07:04 PM12/19/10
to akka...@googlegroups.com
hi daniel,

i tried executing it from danielribeiro-RubyOnAkka-b5a027a; the root dir of your project. This is not the correct dir?

To unsubscribe from this group, send email to akka-user+...@googlegroups.com.

Derek Williams

unread,
Dec 19, 2010, 6:12:18 PM12/19/10
to akka...@googlegroups.com
That was the same error I got as well when I tried to run it.

--
Derek

Daniel Ribeiro

unread,
Dec 19, 2010, 7:49:20 PM12/19/10
to Akka User List
I see what the problem is...

Jruby's rake doesn't fork, like it does with Ruby's rake. Therefore it
can't set the classpath. Using ruby's rake should suffice. A easy
solution is to add puts puts ENV['CLASSPATH'], and set it before
running rake.

I remember Charles nutter mentioning a way around this....

Daniel Ribeiro

unread,
Dec 19, 2010, 10:33:11 PM12/19/10
to Akka User List
I've simplified this whole process. rake genbenchmark will generate
the benchmark.sh, which uses absolute paths and can be run anywhere.

rake genrunner will make the same, but for running any files. The
shell script will receive the filename argument, not the task.

[],
- Daniel Ribeiro

Derek Williams

unread,
Dec 20, 2010, 12:37:25 AM12/20/10
to akka...@googlegroups.com
I didn't realize you were using rake with Ruby and not JRuby,
installing Ruby fixed everything for me, thanks!

My implementation does run faster, but that has probably more to do
with Scala performing faster then JRuby since I am starting up
thousands of actors instead of just a few, although my reducer doesn't
have to wait for all the mappers to finish before it gets started (the
only await command is for the final result).

Either way it is cool to see Akka used with Ruby. I programmed with
Ruby before switching to Scala about 2 years ago. I had a funny
surprise last week, my copy of the RSpec book from Pragmatic
Programmers finally arrived. Ordered that one over 2 years ago. Yay
early access programs. Kinda useless to me now but maybe it has some
decent stuff on writing good tests. I'm still waiting on my "Merb in
Action" book though... oh wait, it's "Rails 3 in Action" now. Due next
year. Only a little bit later then I expected.

--
Derek

Daniel Ribeiro

unread,
Dec 20, 2010, 12:18:33 PM12/20/10
to Akka User List
@Derek
Nice it worked out for you.

I really like Scala as well. It can even be terser than ruby sometimes
(and the implicits approach instead of open classes is such a great
idea, that is coming to ruby on 2.0 in the form of refinements
http://yehudakatz.com/2010/11/30/ruby-2-0-refinements-in-practice/).

In the end, for me, it's just a question of performance, tooling and
how much meta-programming you need. In the end, what is really
exciting is this ability of changing languages, while still sharing
libraries and frameworks, so that we can use the appropriate language
on the appropriate parts, with minimum amount of plumbing.

[],
- Daniel Ribeiro

Peter Veentjer

unread,
Dec 20, 2010, 1:05:38 PM12/20/10
to akka...@googlegroups.com
So what do I need to do to get it up and running?

Daniel Ribeiro

unread,
Dec 20, 2010, 4:42:10 PM12/20/10
to Akka User List
On the lastest version:

With jruby's rake:
$ rake genbenchmark
$ ./benchmark.sh chunksize actorsize

With ruby's rake:
$ rake benchmark[chunkSize,mapActorsCount]

That's it
> > <akka-user%2Bunsu...@googlegroups.com<akka-user%252Buns...@googlegroups.com>
>
> > > > >> > >> .
> > > > >> > >> > > For more options, visit this group athttp://
> > > > >> > >> groups.google.com/group/akka-user?hl=en.
>
> > > > >> > >> > --
> > > > >> > >> > Derek
>
> > > > >> > >> --
> > > > >> > >> You received this message because you are subscribed to the
> > Google
> > > > >> > >> Groups
> > > > >> > >> "Akka User List" group.
> > > > >> > >> To post to this group, send email to
> > akka...@googlegroups.com.
> > > > >> > >> To unsubscribe from this group, send email to
>
> > > > >> > >> akka-user+...@googlegroups.com<akka-user%2Bunsu...@googlegroups.com>
> > <akka-user%2Bunsu...@googlegroups.com<akka-user%252Buns...@googlegroups.com>

Peter Veentjer

unread,
Dec 20, 2010, 5:13:59 PM12/20/10
to akka...@googlegroups.com
I downloaded the newest stuff. I generated the benchmark.sh file using JRuby and it is created successfully.

But if I call ./benchmark.sh 500 2 I get the following error:

alarmnummer@alarmnummer-desktop:~/danielribeiro-RubyOnAkka-2eb3f60$ sh benchmark.sh 500 2
Error opening script file: /home/alarmnummer/danielribeiro-RubyOnAkka-2eb3f60/500 (No such file or directory)


To unsubscribe from this group, send email to akka-user+...@googlegroups.com.

Daniel Ribeiro

unread,
Dec 20, 2010, 7:10:19 PM12/20/10
to akka...@googlegroups.com
Can you post your benchmark.sh?

Daniel Ribeiro

unread,
Dec 20, 2010, 7:27:47 PM12/20/10
to akka...@googlegroups.com
Never mind, This should work:

#!/bin/bash
CLASSPATH=./vendor:./vendor/akka_2.8.0-0.10.jar:./vendor/akka-core_2.8.0-0.10.jar:./vendor/scala-library.jar jruby -Ilib lib/benchmarking_akka.rb $1 $2

Daniel Ribeiro

unread,
Dec 20, 2010, 7:31:13 PM12/20/10
to akka...@googlegroups.com
I've uploaded the new version with both runner.sh and benchmark.sh. No need for gen
Reply all
Reply to author
Forward
0 new messages