<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0"><channel><atom:link rel="hub" href="http://tumblr.superfeedr.com/" xmlns:atom="http://www.w3.org/2005/Atom"/><description>Various posts by the hAkkers in the Akka Team and the Akka community.

Links:
Akka Home
Akka Docs</description><title>Let it crash</title><generator>Tumblr (3.0; @hakkers)</generator><link>http://letitcrash.com/</link><item><title>Testing with Specs2 and TestKit</title><description>&lt;p&gt;Thanks to some feedback was I finally in the position to write up a short piece about how to combine &lt;a href="http://specs2.org/" title="Specs2" target="_blank"&gt;Specs2&lt;/a&gt; with our TestKit. And to properly persist this piece of information, I added it to our docs, so please &lt;a href="http://doc.akka.io/docs/akka/snapshot/scala/testing.html#Different_Testing_Frameworks" target="_self"&gt;read more here&lt;/a&gt;.&lt;/p&gt;</description><link>http://letitcrash.com/post/23731667955</link><guid>http://letitcrash.com/post/23731667955</guid><pubDate>Fri, 25 May 2012 15:25:18 +0200</pubDate><category>Author: Roland Kuhn</category><category>testing</category><category>specs2</category><dc:creator>pionic</dc:creator></item><item><title>Watch the Routees</title><description>&lt;p&gt;I answered a &lt;a href="https://groups.google.com/d/topic/akka-user/uCzuZAUpPDE/discussion" target="_blank"&gt;question&lt;/a&gt; in the Akka mailinglist with example code that might be interesting if you need to do something similar. The use case is to perform a job consisting of a bunch of tasks. Delegate the tasks to worker actors, behind a &lt;a href="http://doc.akka.io/docs/akka/2.0.1/scala/routing.html"&gt;router&lt;/a&gt;. Aggregate the results of workers and reply with one answer. Additionally, a worker should retry failed messages a few times, and then stop. If one worker terminates due to failure the whole job should be aborted. &lt;/p&gt;
&lt;p&gt;Here is the example code:&lt;/p&gt;
&lt;script src="https://gist.github.com/2764019.js?file=RouterApp.scala" type="text/javascript"&gt;&lt;/script&gt;&lt;p&gt;The retry is implemented by forwarding the failing message to itself in preRestart. This places the message last in the mailbox, so ordering of messages is assumed to be unimportant for the processing of the tasks. Note that forward is necessary to retain the master as sender.&lt;/p&gt;
&lt;p&gt;Workers are restarted in case of failure, and stopped after 2 restarts. This is handled by the supervisor of the worker routees, i.e. the router. A supervisorStrategy is specified when creating the router.&lt;/p&gt;
&lt;p&gt;To be able to abort the whole job when one worker is stopped the master subscribe to termination, death watch, of the workers. References to the workers is obtained by sending a CurrentRoutees message to the router, which replies with RouterRoutees. context.watch(actorRef) initiates the death watch subscription. Terminated is delivered when a worker has been stopped.&lt;/p&gt;
&lt;p&gt;When the master stops itself the children are also stopped, i.e. the router and its worker routees are stopped together with the master.&lt;/p&gt;
&lt;p&gt;Aggregation is implemented by correlating the replies from the workers with a message id.&lt;/p&gt;</description><link>http://letitcrash.com/post/23532935686</link><guid>http://letitcrash.com/post/23532935686</guid><pubDate>Tue, 22 May 2012 08:32:47 +0200</pubDate><category>Author: Patrik Nordwall</category><category>akka</category><category>sample</category><dc:creator>patriknw</dc:creator></item><item><title>Follow-Up: sbt-assembly now likes reference.conf!</title><description>&lt;p&gt;In my &lt;a href="http://letitcrash.com/post/21025950392/howto-sbt-assembly-vs-reference-conf" target="_blank"&gt;last post&lt;/a&gt; I said that configuring &lt;a href="https://github.com/sbt/sbt-assembly/" target="_blank"&gt;sbt-assembly&lt;/a&gt; to merge our beloved configuration files would not warrant its own plugin. Of course copy-pasting all that code would not have been really that nice either. What a pickle …&lt;/p&gt;
&lt;p&gt;Following Mr. Holmes’ logic you will have guessed the solution: big kudos to Eugene for assisting with and merging &lt;a href="https://github.com/sbt/sbt-assembly/pull/37" target="_blank"&gt;my patch&lt;/a&gt; and releasing sbt-assembly version 0.8.0, which now does the right thing out of the box. It even is very easy to configure to merge other files, too (e.g. application.conf), just have a look at the project page linked above. And if all of that is not enough for your very special use-case, you can easily write your own strategy, which in best SBT tradition is documented &lt;a href="https://github.com/sbt/sbt-assembly/blob/master/src/main/scala/sbtassembly/Plugin.scala#L30" target="_blank"&gt;here&lt;/a&gt;.&lt;/p&gt;</description><link>http://letitcrash.com/post/21706121997</link><guid>http://letitcrash.com/post/21706121997</guid><pubDate>Tue, 24 Apr 2012 10:01:00 +0200</pubDate><category>Author: Roland Kuhn</category><category>sbt-assembly</category><category>config</category><dc:creator>pionic</dc:creator></item><item><title>HOWTO: sbt-assembly vs. reference.conf</title><description>&lt;p&gt;One of the things which changed in Akka 2.0 was the new &lt;a href="https://github.com/typesafehub/config" target="_blank"&gt;configuration system&lt;/a&gt;, which is based upon the assumption that all used settings are defined in resources named “/reference.conf” and found on the classpath. This composes nicely, as then different libraries can coexist in the same project and the configuration systemjust works. One situation where this breaks, however, is when using fat jars for deployment. The problem usually shows up as&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;ConfigException$Missing: No configuration setting found for key: &amp;#8216;akka.version&amp;#8217;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;and the cause is that during packaging of the fat jar only one of the many “reference.conf” files was copied instead of merging them all.&lt;/p&gt;
&lt;p&gt;There was a &lt;a href="https://groups.google.com/d/msg/akka-user/p6C0Stlgbe0/O1Rk7YQiLekJ" target="_blank"&gt;discussion&lt;/a&gt; showing a solution when using proGuard, and I thought something similar should be possible using &lt;a href="https://github.com/sbt/sbt-assembly" target="_blank"&gt;sbt-assembly&lt;/a&gt;. Eugene was so nice to add a hook which allows this to work, based on &lt;a href="https://github.com/sbt/sbt-assembly/issues/32" target="_blank"&gt;this ticket&lt;/a&gt;, so here it goes.&lt;/p&gt;
&lt;p&gt;The following of course assumes that the sbt-assembly plugin has been installed in version 0.7.4, for which the following addition is needed:&lt;/p&gt;
&lt;script src="https://gist.github.com/2377391.js?file=plugins.sbt" type="text/javascript"&gt;&lt;/script&gt;&lt;p&gt;Then the code to make SBT do the right thing is so little that it does not warrant its own plugin (it only looks long because this blog’s style is like literally writing on the margins of a newpaper):&lt;/p&gt;
&lt;script src="https://gist.github.com/2377391.js?file=Build.scala" type="text/javascript"&gt;&lt;/script&gt;&lt;p&gt;Making the location of the merged “reference.conf” configurable or merging other things is left as an exercise to the reader.&lt;/p&gt;
&lt;p&gt;As a bonus, this adds a “merge-reference” task which you can invoke to perform the merge and show the location:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&amp;gt; show merge-reference&lt;br/&gt;[info] reference.conf&lt;/p&gt;
&lt;/blockquote&gt;</description><link>http://letitcrash.com/post/21025950392</link><guid>http://letitcrash.com/post/21025950392</guid><pubDate>Fri, 13 Apr 2012 17:20:00 +0200</pubDate><category>Author: Roland Kuhn</category><category>config</category><category>sbt-assembly</category><dc:creator>pionic</dc:creator></item><item><title>Carl Hewitt explains the essence of the Actor Model of...</title><description>&lt;iframe style="height: 225px;width: 400px" src="http://channel9.msdn.com/Shows/Going+Deep/Hewitt-Meijer-and-Szyperski-The-Actor-Model-everything-you-wanted-to-know-but-were-afraid-to-ask/player?w=512&amp;h=288" frameborder="0" scrolling="no"&gt;&lt;/iframe&gt;&lt;br/&gt;&lt;br/&gt;&lt;p&gt;Carl Hewitt explains the essence of the Actor Model of computation. &lt;/p&gt;
&lt;p&gt;Brillant. Enjoy.  &lt;/p&gt;</description><link>http://letitcrash.com/post/20964174345</link><guid>http://letitcrash.com/post/20964174345</guid><pubDate>Thu, 12 Apr 2012 16:20:00 +0200</pubDate><category>Author: Jonas Bonér</category><dc:creator>jonasboner</dc:creator></item><item><title>50 million messages per second - on a single machine</title><description>&lt;p&gt;50 million messages per second on a single machine is mind blowing!&lt;/p&gt;
&lt;p&gt;We have measured this for a micro benchmark of Akka 2.0.&lt;/p&gt;
&lt;p&gt;As promised in &lt;a href="http://letitcrash.com/post/17607272336/scalability-of-fork-join-pool"&gt;Scalability of Fork Join Pool&lt;/a&gt; I will here describe one of the tuning settings that can be used to achieve even higher throughput than the amazing numbers presented previously. Using the same benchmark as in &lt;a href="http://letitcrash.com/post/17607272336/scalability-of-fork-join-pool"&gt;Scalability of Fork Join Pool&lt;/a&gt; and only changing the configuration we go from 20 to 50 million messages per second.&lt;/p&gt;
&lt;p&gt;The micro benchmark use pairs of actors sending messages to each other, classical ping-pong. All sharing the same fork join dispatcher.&lt;/p&gt;
&lt;script src="https://gist.github.com/2286308.js?file=TellThroughputPerformanceSpec2.scala" type="text/javascript"&gt;&lt;/script&gt;&lt;p&gt;Hardware and configuration:&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;Processor: 48 core AMD Opteron (4 dual-socket with 6 core AMD® Opteron™ 6172&amp;#160;2.1&amp;#160;GHz Processors)&lt;/li&gt;
&lt;li&gt;Memory: 128&amp;#160;GB ECC DDR3&amp;#160;1333&amp;#160;MHz memory, 16 DIMMs&lt;/li&gt;
&lt;li&gt;OS: Ubuntu 11.10&lt;/li&gt;
&lt;li&gt;JVM: OpenJDK 7, version “1.7.0_147-icedtea”, (IcedTea7&amp;#160;2.0) (7~b147-2.0-0ubuntu0.11.10.1)&lt;/li&gt;
&lt;li&gt;JVM settings: -server -XX:+UseNUMA -XX:+UseCondCardMark -XX:-UseBiasedLocking -Xms1024M -Xmx2048M -Xss1M -XX:MaxPermSize=128m -XX:+UseParallelGC&lt;/li&gt;
&lt;li&gt;Akka version: 2.0&lt;/li&gt;
&lt;li&gt;Dispatcher configuration other than default: &lt;br/&gt;parallelism 48 of fork-join-exector&lt;br/&gt;throughput as described  &lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;Here is the result of using different values for the &lt;em&gt;throughput&lt;/em&gt; &lt;a href="http://doc.akka.io/docs/akka/2.0/scala/dispatchers.html"&gt;setting of the dispatcher&lt;/a&gt;. 5 is the default value. The test was run with 96 actors and each test result was based on at least 15 seconds of execution time (960 million messages), long warmup excluded.&lt;/p&gt;
&lt;p&gt;&lt;img src="http://media.tumblr.com/tumblr_m1v8zq7Whc1r4xnid.png"/&gt;&lt;/p&gt;
&lt;p&gt;As you see the number of processed messages per second increase dramatically with increased &lt;em&gt;throughput&lt;/em&gt; configuration setting up to 20.&lt;/p&gt;
&lt;p&gt;When using even higher &lt;em&gt;throughput&lt;/em&gt; values the curve becomes more flat, but with a maximum above 50 million messages per second.&lt;/p&gt;
&lt;p&gt;&lt;img src="http://media.tumblr.com/tumblr_m1v99ffqTh1r4xnid.png"/&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;What is the magic behind the &lt;em&gt;throughput&lt;/em&gt; setting?&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;It configures how many messages an actor should process in a batch. For example &lt;em&gt;throughput=20&lt;/em&gt; means that once the dispatcher schedules a thread for the actor it will continue to process 20 messages, if the mailbox isn&amp;#8217;t empty, before returning the thread to the pool.&lt;/p&gt;
&lt;p&gt;The trade-off is that other actors that use the same dispatcher might have to wait longer before they get a chance to run, i.e. you trade higher throughput for increased latency. It is the classic tradeoff of throughput vs fairness. The optimal value depends on your use case, e.g. how long the message processing time is.&lt;/p&gt;
&lt;p&gt;A related &lt;a href="http://doc.akka.io/docs/akka/2.0/general/configuration.html#akka-actor"&gt;configuration setting&lt;/a&gt; is &lt;em&gt;throughput-deadline-time&lt;/em&gt;, which defines how long time the actor is allowed to continue to process messages from the mailbox before the thread is returned to the pool.&lt;/p&gt;
&lt;p&gt;Finally, let&amp;#8217;s take a look at how the message throughput (msg/s) scales with number of actors when using &lt;em&gt;throughput&lt;/em&gt; configuration value 200.&lt;/p&gt;
&lt;p&gt;&lt;img src="http://media.tumblr.com/tumblr_m1vaeuv4T11r4xnid.png"/&gt;&lt;/p&gt;
&lt;p&gt;As you can see, we now get more than 50 million messages per second. Not bad at all. Download &lt;a href="http://akka.io/"&gt;Akka&lt;/a&gt; 2.0 yourself and give her a spin. &lt;/p&gt;
&lt;p&gt;Happy hAkking. &lt;/p&gt;</description><link>http://letitcrash.com/post/20397701710</link><guid>http://letitcrash.com/post/20397701710</guid><pubDate>Tue, 03 Apr 2012 08:20:00 +0200</pubDate><category>Author: Patrik Nordwall</category><category>akka</category><category>benchmark</category><dc:creator>patriknw</dc:creator></item><item><title>Kindle version of the latest Akka docs</title><description>&lt;p&gt;Kindle version of the latest Akka docs: &lt;a href="http://download.akka.io/downloads/akka-2.1-SNAPSHOT.mobi"&gt;http://download.akka.io/downloads/akka-2.1-SNAPSHOT.mobi&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Enjoy.&lt;/p&gt;</description><link>http://letitcrash.com/post/19581284508</link><guid>http://letitcrash.com/post/19581284508</guid><pubDate>Mon, 19 Mar 2012 19:55:42 +0100</pubDate><dc:creator>jonasboner</dc:creator></item><item><title>Typesafe Stack 2.0 Released</title><description>&lt;p&gt;We are proud to announce that Typesafe Stack 2.0 have been released. &lt;/p&gt;
&lt;p&gt;Some of the highlights are: &lt;/p&gt;
&lt;ul&gt;&lt;li&gt;Akka 2.0&lt;/li&gt;
&lt;li&gt;Play 2.0 (and Play Mini)&lt;/li&gt;
&lt;li&gt;Getting Started Templates&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;Found out more about the details on &lt;a href="http://akka.io/news/2012/03/13/typesafe-stack-20-released.html"&gt;Akka News&lt;/a&gt;.&lt;/p&gt;</description><link>http://letitcrash.com/post/19234085027</link><guid>http://letitcrash.com/post/19234085027</guid><pubDate>Tue, 13 Mar 2012 14:23:06 +0100</pubDate><category>Author: Jonas Bonér</category><dc:creator>jonasboner</dc:creator></item><item><title>Akka - Dr Dobb's Jolt Award Winner</title><description>&lt;p&gt;We are very proud to announce that Akka received an honorable mention in the Third Party Libraries category in the Dr Dobb&amp;#8217;s Jolt Awards 2012.&lt;/p&gt;
&lt;p&gt;Read more here: &lt;a href="http://drdobbs.com/joltawards/232601043?pgno=2" title="http://drdobbs.com/joltawards/232601043?pgno=2"&gt;&lt;a href="http://drdobbs.com/joltawards/232601043?pgno=2"&gt;http://drdobbs.com/joltawards/232601043?pgno=2&lt;/a&gt;&lt;/a&gt;&lt;/p&gt;</description><link>http://letitcrash.com/post/19194737061</link><guid>http://letitcrash.com/post/19194737061</guid><pubDate>Mon, 12 Mar 2012 21:51:00 +0100</pubDate><category>Author: Jonas Bonér</category><dc:creator>jonasboner</dc:creator></item><item><title>When to use TypedActors</title><description>&lt;p&gt;This is another topic which comes up from time to time on the &lt;a href="https://groups.google.com/forum/#!forum/akka-user" title="akka-user" target="_blank"&gt;mailing list&lt;/a&gt;: typed actors are “nice”, but some things work differently or not at all, so what exactly are they good for?&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;Philosophy&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;As a little historical side-note, typed actors in Akka 1.x were implemented using runtime byte-code generation by the &lt;a href="http://aspectwerkz.codehaus.org/" target="_blank"&gt;AspectWerkz&lt;/a&gt; library, which is no longer actively maintained. Thus, Viktor re-wrote them based on JDK proxies, while integrating them more smoothly with the rest of Akka. In version 2.0, typed actors are free of external dependencies and part of the core module &lt;em&gt;“akka-actor”&lt;/em&gt;. They can send and receive messages like normal actors, be supervised by normal actors and supervise normal actors, they can intercept life-cycle monitoring messages and take part in the EventStream, but all of this does not come quite as naturally as for the normal untyped actors. The reason is that typed actors do not ideally model what actors are: entities which process an incoming stream of messages with their behavior, changing their state in response and generating other messages. The simplicity of this model is what enables perfect encapsulation in a truly object-oriented way and it enables the location transparency and fault tolerance of actor systems.&lt;/p&gt;
&lt;p&gt;But typed actors do have their place, as hybrids between POJO and Actor: exactly at the touching point where actor systems meet non-actor code. Communication between actors means placing message objects into the recipient’s mailbox, which is not easily done if the receiver shall be a plain Java object. A typed actor is a normal actor wrapped in a given interface, responding to method calls instead of message sends.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;A Simple Example&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;
&lt;script src="https://gist.github.com/2012571.js?file=typedactordemo.scala" type="text/javascript"&gt;&lt;/script&gt;&lt;p&gt;The Service is represented by a simplified interface, which is implemented by an inconspicuous class ServiceImpl. The vigilant reader will have noticed that the special magic enters on line 18 by way of &lt;a href="http://doc.akka.io/api/akka/2.0/#akka.actor.TypedActor%24" target="_blank"&gt;TypedActor&lt;/a&gt;.context, that returns the &lt;a href="http://doc.akka.io/api/akka/2.0/#akka.actor.ActorContext" target="_blank"&gt;ActorContext&lt;/a&gt; of the untyped actor which will be wrapping this implementation. The next line then demonstrates the creation of the child actor which will be servicing the requests. Notice how the asynchronous nature of actor communication is retained by returning a Future for sending the (eventual) reply back to the requesting party.&lt;/p&gt;
&lt;p&gt;The only noteworthy action with respect to typed actors is shown on lines 38ff, where the typed actor is instantiated. Declaring a normal actor and handling &lt;a href="http://doc.akka.io/api/akka/2.0/#akka.dispatch.Future" target="_blank"&gt;Future&lt;/a&gt; callbacks is assumed prerequisite knowledge for this post.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;What else can you do?&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;What you just witnessed is the basic principle of wrapping a function implemented by an actor system into an interface which can be consumed by “normal” non-actor code. This should be enough to get going, but you will probably at some point want to learn about the various &lt;a href="http://akka.io/docs/akka/2.0/scala/typed-actors.html#Supervisor_Strategy" target="_blank"&gt;additional traits&lt;/a&gt;: &lt;a href="http://doc.akka.io/api/akka/2.0/#akka.actor.TypedActor%24%24Supervisor" target="_blank"&gt;&lt;em&gt;Supervisor&lt;/em&gt;&lt;/a&gt;, &lt;a href="http://doc.akka.io/api/akka/2.0/#akka.actor.TypedActor%24%24Receiver" target="_blank"&gt;&lt;em&gt;Receiver&lt;/em&gt;&lt;/a&gt; (for receiving normal messages), life-cycle callbacks &lt;a href="http://doc.akka.io/api/akka/2.0/#akka.actor.TypedActor%24%24PreStart" target="_blank"&gt;&lt;em&gt;PreStart&lt;/em&gt;&lt;/a&gt;, &lt;a href="http://doc.akka.io/api/akka/2.0/#akka.actor.TypedActor%24%24PreRestart" target="_blank"&gt;&lt;em&gt;PreRestart&lt;/em&gt;&lt;/a&gt;, &lt;a href="http://doc.akka.io/api/akka/2.0/#akka.actor.TypedActor%24%24PostRestart" target="_blank"&gt;&lt;em&gt;PostRestart&lt;/em&gt;&lt;/a&gt; and &lt;a href="http://doc.akka.io/api/akka/2.0/#akka.actor.TypedActor%24%24PostStop" target="_blank"&gt;&lt;em&gt;PostStop&lt;/em&gt;&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;What should you NOT do?&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Most importantly, use them sparingly: untyped actors make the actor model more explicit, which will benefit your application design. That said, in those cases where a typed actor is preferable (for example as shown above), only declare methods which return either Unit (i.e. «void») or a Future. All other possibilities lead to blocking behavior when sending an invocation to the actor, and parking one thread only to wake up another is not a good idea. Also, making the reply (if any) asynchronous enables you to distribute your application across multiple network nodes without running into the &lt;a href="http://labs.oracle.com/techrep/1994/abstract-29.html" target="_blank"&gt;RPC troubles&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;And above all: never send a «this» reference to anybody, which includes arguments to method invocations on different objects. If you for example register the typed actor implementation for a callback, that callback will be executed concurrently to the typed actor itself and in a different context, leading to all those pesky locking problems which you wanted to rid yourself of by using Akka. If you must send around something which represents the typed actor, always use «TypedActor.self».&lt;/p&gt;</description><link>http://letitcrash.com/post/19074284309</link><guid>http://letitcrash.com/post/19074284309</guid><pubDate>Sat, 10 Mar 2012 21:21:00 +0100</pubDate><category>Author: Roland Kuhn</category><dc:creator>pionic</dc:creator></item><item><title>Akka 2.0 has landed</title><description>&lt;p&gt;Finally, after months of hard work, we are proud to announce Akka 2.0 final. &lt;/p&gt;
&lt;p&gt;Read more about it in this &lt;a href="http://blog.typesafe.com/introducing-akka-20-2756"&gt;blog post&lt;/a&gt; and the &lt;a href="http://akka.io/news/2012/03/06/akka-20-released.html"&gt;release notes&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Now take her for a spin. &lt;/p&gt;</description><link>http://letitcrash.com/post/18841805227</link><guid>http://letitcrash.com/post/18841805227</guid><pubDate>Tue, 06 Mar 2012 10:33:07 +0100</pubDate><category>Author: Jonas Bonér</category><dc:creator>jonasboner</dc:creator></item><item><title>A sample application showcasing play-mini and Akka </title><description>&lt;p&gt;In Akka 2.0 we have decided to replace the Mist based HTTP module with a module called play-mini. With play-mini it&amp;#8217;s possible not only to create REST based API in an easy fashion but also to use the power of the Play framework.&lt;br/&gt;&lt;br/&gt;In this post we will describe the steps needed to build a simple REST service and have it interact with actors in an ActorSystem. It will also show the power of Akka&amp;#8217;s futures and how to apply them in a real world example.&lt;br/&gt;&lt;br/&gt;If you are not familiar with the infinite monkey theorem you can study the background of the application here:&lt;a href="http://en.wikipedia.org/wiki/Infinite_monkey_theorem" target="_blank"&gt; &lt;a href="http://en.wikipedia.org/wiki/Infinite_monkey_theorem"&gt;http://en.wikipedia.org/wiki/Infinite_monkey_theorem&lt;/a&gt;&lt;/a&gt;&lt;br/&gt;(Disclaimer: the sample application used is not a complete implementation, or a proof, of the theorem in any way.) &lt;br/&gt;&lt;br/&gt;&lt;strong&gt;Prerequisites&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;SBT 0.11.2 installed&lt;/li&gt;
&lt;li&gt;IDE of your choice (we recommend Eclipse, IntelliJ, &amp;lt;insert your favorite IDE here&amp;gt;)&lt;/li&gt;
&lt;li&gt;Git (not mandatory but simplifies things [which is something that can be said about Git in general])&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;&lt;strong&gt;Download the Application Code&lt;/strong&gt;&lt;br/&gt;&lt;br/&gt;Start by downloading the code to your local machine. Open a terminal and type the following:&lt;br/&gt;&lt;em&gt;&amp;gt; git clone git@github.com:henrikengstrom/PlayMiniSample.git&lt;/em&gt;&lt;br/&gt;&lt;em&gt;&amp;gt; cd PlayMiniSample&lt;/em&gt;&lt;br/&gt;&lt;em&gt;&amp;gt; sbt&lt;/em&gt;&lt;br/&gt;&lt;em&gt;sbt&amp;gt; compile&lt;/em&gt;&lt;br/&gt;&lt;br/&gt;That last command will print a lot of traces but it should end with something similar to:&lt;br/&gt;&lt;em&gt;[info] Compiling 2 Scala sources to /&amp;lt;your_structure&amp;gt;/PlayMiniSample/target/scala-2.9.1/classes&amp;#8230;&lt;/em&gt;&lt;br/&gt;&lt;em&gt;[success] Total time: 5&amp;#160;s, completed Feb 19, 2012&amp;#160;10:31:41 AM&lt;/em&gt;&lt;br/&gt;&lt;br/&gt;Okay, that&amp;#8217;s it. Now you have the code downloaded and compiled. &lt;br/&gt;Before giving the application a spin it&amp;#8217;s a good idea to go through the different parts so you get a better understanding of it all.&lt;br/&gt;&lt;br/&gt;&lt;strong&gt;Application Dissection&lt;/strong&gt;&lt;br/&gt;&lt;br/&gt;Play-mini gives you the tools to create a REST API and also easily have it integrate with your ActorSystem. You need to do 2 things in order to create a play-mini application:&lt;/p&gt;
&lt;ol&gt;&lt;li&gt;Create a Global class to indicate to play-mini what class to run&lt;/li&gt;
&lt;li&gt;Have your play-mini class extend com.typesafe.play.mini.Application:&lt;/li&gt;
&lt;/ol&gt;&lt;p&gt;&lt;strong&gt;Routing &lt;/strong&gt;&lt;br/&gt;&lt;br/&gt;When extending com.typesafe.play.mini.Application you have to provide a route implementaion. This is where the routing logic should go, i.e. where you add all URL paths the application should handle.&lt;br/&gt;&lt;br/&gt;The sample application handles two paths:&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;HTTP GET /ping&lt;/li&gt;
&lt;li&gt;HTTP POST /write&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;The anatomy of the route method is to first state the HTTP method and thereafter what path the method should be applied to, e.g.:&lt;br/&gt;&lt;em&gt;GET(Path(&amp;#8220;/ping&amp;#8221;)) or&lt;/em&gt;&lt;br/&gt;&lt;em&gt;POST(Path(&amp;#8220;/write&amp;#8221;))&lt;/em&gt;&lt;br/&gt;&lt;br/&gt;The result returned is a &amp;#8220;Action&amp;#8221;. For more information about this see: &lt;br/&gt;&lt;a href="https://github.com/playframework/Play20/wiki/ScalaActions" target="_blank"&gt;&lt;a href="https://github.com/playframework/Play20/wiki/ScalaActions"&gt;https://github.com/playframework/Play20/wiki/ScalaActions&lt;/a&gt;&lt;/a&gt;&lt;br/&gt;   &lt;br/&gt;Let&amp;#8217;s dissect the HTTP POST in the sample.&lt;/p&gt;
&lt;script src="https://gist.github.com/1863329.js?file=gistfile1.scala" type="text/javascript"&gt;&lt;/script&gt;&lt;p&gt;Interesting lines are:&lt;br/&gt;&lt;em&gt;Line 1: Declares HTTP method and path. Also adds an &amp;#8220;implicit request&amp;#8221;. The latter part is required by line 3, i.e. the form handling.&lt;/em&gt;&lt;br/&gt;&lt;em&gt;Line 3: Extracts parameters posted in the request with help of the Form extractor (line 17).&lt;/em&gt;&lt;br/&gt;&lt;em&gt;Line 4: AsyncResult instructs the code to park the HTTP request and release the thread.&lt;/em&gt;&lt;br/&gt;&lt;em&gt;Line 5: This is where the call to Akka is done with &amp;#8220;shakespeare&amp;#160;? numberMonkeys&amp;#8221;. This returns an Akka Future instance and that Future is then mapped to the case class &amp;#8220;Result&amp;#8221;. (The rest of the code, i.e. &amp;#8220;.asPromise.map&amp;#8221; is merely a way of converting from an Akka Future into Play&amp;#8217;s own Future implementation.)&lt;/em&gt;&lt;br/&gt;&lt;em&gt;Line 7-11: Builds the reply, in this case a simple string.&lt;/em&gt;&lt;br/&gt;&lt;em&gt;Line 12: Returns the result. There are a a set of predefined replies pre-defined in Play (for more info see: &lt;a href="https://github.com/playframework/Play20/wiki/ScalaActions"&gt;https://github.com/playframework/Play20/wiki/ScalaActions&lt;/a&gt;)&lt;/em&gt;&lt;br/&gt;&lt;br/&gt;&lt;strong&gt;The ActorSystem &lt;/strong&gt;&lt;br/&gt;&lt;br/&gt;Our infinite monkey theorem implementation is quite simple. It consists of two actor types; &lt;em&gt;Shakespeare&lt;/em&gt; and &lt;em&gt;MonkeyWorker&lt;/em&gt;.&lt;br/&gt;&lt;br/&gt;The former receives information about how many monkey workers to use, creates the actors and sends a generated random number which instructs the monkey worker how many words to type.&lt;/p&gt;
&lt;p&gt;A nice feature that should be described in a little more detail is the use of Akka&amp;#8217;s Future implementation. Shakespeare seems to have been quite an astute chap and the same can be said about the Futures implementation in Akka!&lt;/p&gt;
&lt;script src="https://gist.github.com/1863424.js?file=gistfile1.scala" type="text/javascript"&gt;&lt;/script&gt;&lt;p&gt;&lt;em&gt;Line 3-5: This is the part where we create the actors and sends them information about how many words to type. Since we use the ask notation (&amp;#8220;?&amp;#8221;) this means that we get a Future back, or as in this case a list of Future.&lt;/em&gt;&lt;em&gt; Noteworthy is also that the result of each Future will contain a set of strings and this is interestingly enough also what the money workers send back to the &amp;#8220;sender&amp;#8221; as a message.&lt;/em&gt;&lt;br/&gt;&lt;em&gt;Line 7: Extracts each result from the list of futures &lt;/em&gt;&lt;br/&gt;&lt;em&gt;Line 8: Merges all results into one result (Set[String])&lt;/em&gt;&lt;br/&gt;&lt;em&gt;Line 9: Divides the result into two subsets; Shakespearian and non-Shakespearian words  &lt;/em&gt;&lt;br/&gt;&lt;em&gt;Line 10: Creates an instance of the case class Result&lt;/em&gt;&lt;br/&gt;&lt;em&gt;Line 11: Pipes the result back to the &amp;#8220;sender&amp;#8221; which in this case is the HTTP POST part in the route method. &lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;br/&gt;Fore more information about the Akka Future implementation see: &lt;a href="http://akka.io/docs/akka/2.0-RC1/scala/futures.html" target="_blank"&gt;&lt;a href="http://akka.io/docs/akka/2.0-RC1/scala/futures.html"&gt;http://akka.io/docs/akka/2.0-RC1/scala/futures.html&lt;/a&gt;&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;We leave it to the reader to investigate how the MonkeyWorker has been implemented.&lt;br/&gt;&lt;br/&gt;&lt;strong&gt;Running the Application&lt;/strong&gt;&lt;br/&gt;&lt;br/&gt;Want to give the application a test ride?&lt;br/&gt;Just type the following in the terminal window:&lt;br/&gt;&lt;em&gt;&amp;gt;sbt&lt;/em&gt;&lt;br/&gt;&lt;em&gt;sbt&amp;gt; run&lt;/em&gt;&lt;br/&gt;&lt;br/&gt;You should now see something like:&lt;br/&gt;&lt;em&gt;[info] Running play.core.server.NettyServer &lt;/em&gt;&lt;br/&gt;&lt;em&gt;Play server process ID is 30095&lt;/em&gt;&lt;br/&gt;&lt;em&gt;[info] play - Application started (Prod)&lt;/em&gt;&lt;br/&gt;&lt;em&gt;[info] play - Listening for HTTP on port 9000&amp;#8230;&lt;/em&gt;&lt;br/&gt;&lt;br/&gt;Fire up another terminal window and try it out:&lt;br/&gt;&lt;em&gt;&amp;gt; curl http://localhost:9000/ping&lt;/em&gt;&lt;br/&gt;&lt;em&gt;Pong @ 1329654200089&lt;/em&gt;&lt;br/&gt;&lt;br/&gt;That went fine so the application seems to be alive and kicking. Now let&amp;#8217;s get them monkeys busy:&lt;br/&gt;&lt;em&gt;&amp;gt; curl -d &amp;#8220;number=1&amp;#8221; http://localhost:9000/write&lt;/em&gt;&lt;br/&gt;&lt;em&gt;SHAKESPEARE WORDS:&lt;/em&gt;&lt;br/&gt;&lt;em&gt;UNWORTHY WORDS CREATED: 56&lt;/em&gt;&lt;br/&gt;&lt;em&gt;In 40376us&lt;/em&gt;&lt;br/&gt;&lt;br/&gt;Okay, so using one monkey is probably not enough to create Shakespearian words. Let&amp;#8217;s try with 100 monkeys:&lt;br/&gt;&lt;em&gt;&amp;gt; curl -d &amp;#8220;number=100&amp;#8221; http://localhost:9000/write&lt;/em&gt;&lt;br/&gt;&lt;em&gt;SHAKESPEARE WORDS:&lt;/em&gt;&lt;br/&gt;&lt;em&gt;or&lt;/em&gt;&lt;br/&gt;&lt;em&gt;UNWORTHY WORDS CREATED: 4691&lt;/em&gt;&lt;br/&gt;&lt;em&gt;In 133460us&lt;/em&gt;&lt;br/&gt;&lt;br/&gt;Yeah, they typed an &amp;#8220;or&amp;#8221;. Let&amp;#8217;s use one thousand monkey and see what words they can come up with:&lt;br/&gt;&lt;em&gt;&amp;gt; curl -d &amp;#8220;number=1000&amp;#8221; http://localhost:9000/write&lt;/em&gt;&lt;br/&gt;&lt;em&gt;SHAKESPEARE WORDS:&lt;/em&gt;&lt;br/&gt;&lt;em&gt;or&lt;/em&gt;&lt;br/&gt;&lt;em&gt;to&lt;/em&gt;&lt;br/&gt;&lt;em&gt;not&lt;/em&gt;&lt;br/&gt;&lt;em&gt;be&lt;/em&gt;&lt;br/&gt;&lt;em&gt;UNWORTHY WORDS CREATED: 45773&lt;/em&gt;&lt;br/&gt;&lt;em&gt;In 219808us &lt;/em&gt;&lt;br/&gt;&lt;br/&gt;Who said that writing Shakespeare couldn&amp;#8217;t be done by monkeys? :-)&lt;br/&gt;&lt;br/&gt;&lt;strong&gt;Further reading&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;Play-mini: &lt;a href="https://github.com/typesafehub/play2-mini%20" target="_blank"&gt;&lt;a href="https://github.com/typesafehub/play2-mini%C2%A0"&gt;https://github.com/typesafehub/play2-mini &lt;/a&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Akka: &lt;a href="http://akka.io" target="_blank"&gt;&lt;a href="http://akka.io"&gt;http://akka.io&lt;/a&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Play: &lt;a href="http://www.playframework.org/2.0" target="_blank"&gt;&lt;a href="http://www.playframework.org/2.0"&gt;http://www.playframework.org/2.0&lt;/a&gt;&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;Happy hAKKing&lt;br/&gt;&lt;a href="https://twitter.com/#!/h3nk3" target="_blank"&gt;@h3nk3&lt;/a&gt;&lt;/p&gt;</description><link>http://letitcrash.com/post/17888436664</link><guid>http://letitcrash.com/post/17888436664</guid><pubDate>Sun, 19 Feb 2012 17:54:00 +0100</pubDate><category>Author: Henrik Engström</category><dc:creator>litc</dc:creator></item><item><title>Why no mailboxSize in Akka 2 ?</title><description>&lt;p&gt;Akka 1.x exposed a method to query the mailbox size, which was available both from inside an actor and from outside. We removed this method in 2.0 for a number of reasons, and since this topic came up on the mailing list multiple times already, here is my attempt at making the rationale accessible to a broader audience and disburden the akka-user group.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;What are the problems with querying the mailbox size?&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;it takes O(n) time to get some size answer from a concurrent queue, i.e. querying hurts when you will feel the pain the most (it might even take several seconds in case of durable mailboxes at the “wrong moment”)&lt;/li&gt;
&lt;li&gt;the answer is not correct, i.e. it does not need to match the real size  at either the beginning or the end of processing this request&lt;/li&gt;
&lt;li&gt;making it “more correct” involves book-keeping which severely limits scalability&lt;/li&gt;
&lt;li&gt;and even then the number might have changed completely by the time you  receive it in your code (e.g. your thread is scheduled out for 100ms and  you get 100.000 new messages during that time).&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;So, no mailboxSize in the default implementation. (There are even more reasons as soon as you consider remote actor references and the asynchronous nature of everything within Akka, just to name a few.)&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;Why would you want to use it anyway?&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Assuming there would be a method to query the mailbox size from within an actor (doing it from without is really impossible in a distributed setting), and assuming that the actor detects that messages are piling up faster than it can process them, what would its plan of action be? Slowing down the senders—by way of a bounded queue—is basically the only thing it can do itself. Other than that only the supervisor can do something, but your application is likely not prepared to handle that, since all the supervisor can do is terminate the poor guy, invalidating all the references the senders have.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;But I want to check periodically and interrupt my long-running task when new messages arrive …&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;That is not a good idea, because this way you block the processing of internal messages (system messages) which are used in the implementation of supervision, actor selections and other things. It is a much better approach to break up long-running tasks into smaller packages and have the actor send these to itself continuously until the job is done; that way it stays fully reactive and does not hog resources uncontrollably. Or you hand off the big pieces of work to Futures, compose those with the awesome &lt;a href="http://akka.io/api/akka/snapshot/#akka.dispatch.Future" title="Future API" target="_blank"&gt;Future API&lt;/a&gt; and feed the result back to the target actor using &lt;a href="http://akka.io/docs/akka/2.0-RC1/scala/actors.html#ask-send-and-receive-future" title="PipeTo Pattern" target="_blank"&gt;pipeTo&lt;/a&gt; (or callbacks as per onSuccess, etc.).&lt;/p&gt;
&lt;script src="https://gist.github.com/1844153.js?file=pipeTo.scala"&gt;&lt;/script&gt;&lt;p&gt;&lt;em&gt;&lt;strong&gt;So, what is the recommended way?&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;When designing an application, you will immediately spot (most of) the hot spots and create these actors using &lt;a href="http://akka.io/docs/akka/2.0-RC1/scala/routing.html" title="Routers" target="_blank"&gt;Routers&lt;/a&gt;. And if you forget one, don’t worry, it is quite painless to insert “.withRouterConfig(RoundRobinRouter(10))” when testing reveals a bottle-neck. This gets even better when using &lt;a href="http://akka.io/docs/akka/2.0-RC1/scala/routing.html#dynamically-resizable-routers" target="_blank"&gt;Resizers&lt;/a&gt;, which add elasticity to the scaling.&lt;/p&gt;
&lt;script src="https://gist.github.com/1844153.js?file=resizer.scala"&gt;&lt;/script&gt;&lt;p&gt;&lt;em&gt;&lt;strong&gt;Okay, I considered all this and I still want mailbox metrics.&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;In case you cannot do without, it is quite easy to write your own mailbox implementation, building on the traits in the akka.dispatch package and inserting book-keeping code into enqueue() and dequeue(). Then you could either use down-casting (evil) or keep track of your mailboxes in an akka.actor.Extension (recommended) to access the stats from within your actor and do whatever is necessary.&lt;/p&gt;
&lt;p&gt;But wait: did I mention that it might even be easier to tag latency-critical (but not too high frequency) messages with timestamps and react on the &lt;em&gt;age&lt;/em&gt; of a message when processing it?&lt;/p&gt;
&lt;p&gt;So, in summary: while there still is a way to get the mailbox size, you will probably never actually need it.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;PS: &lt;/strong&gt;In case you need mailbox metrics for monitoring and in general operating a deployed system, you might want to have a look at the &lt;a href="http://typesafe.com/products/typesafe-subscription" title="Typesafe Subscription" target="_blank"&gt;Typesafe Console&lt;/a&gt;.&lt;/p&gt;</description><link>http://letitcrash.com/post/17707262394</link><guid>http://letitcrash.com/post/17707262394</guid><pubDate>Thu, 16 Feb 2012 12:25:00 +0100</pubDate><category>akka</category><category>Author: Roland Kuhn</category><dc:creator>pionic</dc:creator></item><item><title>Scalability of Fork Join Pool</title><description>&lt;p&gt;Akka 2.0 message passing throughput scales way better on multi-core hardware than in previous versions, thanks to the new fork join executor developed by Doug Lea. One micro benchmark illustrates a 1100% increase in throughput!&lt;/p&gt;
&lt;p&gt;The new 48 core server had arrived and we were excited to run the benchmarks on the new hardware, but it was sad to see the initial results. It didn&amp;#8217;t scale! What was wrong?&lt;/p&gt;
&lt;p&gt;&lt;img src="http://media.tumblr.com/tumblr_lzdvyul8Y31r4xnid.jpg"/&gt;&lt;/p&gt;
&lt;p&gt;The purpose of the used micro benchmark is to see how throughput of message send and receive is affected by increasing number of concurrent, active, actors sharing the same dispatcher. Pairs of actors send messages to each other, classical ping-pong. Load is increased by adding more pairs of actors that are processing messages in parallel with other actors.&lt;/p&gt;
&lt;script src="https://gist.github.com/1826673.js"&gt; &lt;/script&gt;&lt;p&gt;Full source code of the benchmark: &lt;a href="https://github.com/jboner/akka/blob/v2.0-M4/akka-actor-tests/src/test/scala/akka/performance/microbench/TellThroughputPerformanceSpec.scala"&gt;TellThroughputPerformanceSpec.scala&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Hardware and configuration:&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;Processor: 48 core AMD Opteron (4 dual-socket with 6 core AMD® Opteron™ 6172&amp;#160;2.1&amp;#160;GHz Processors)&lt;/li&gt;
&lt;li&gt;Memory: 128&amp;#160;GB ECC DDR3&amp;#160;1333&amp;#160;MHz memory, 16 DIMMs&lt;/li&gt;
&lt;li&gt;OS: Ubuntu 11.10&lt;/li&gt;
&lt;li&gt;JVM: OpenJDK 7, version &amp;#8220;1.7.0_147-icedtea&amp;#8221;, (IcedTea7&amp;#160;2.0) (7~b147-2.0-0ubuntu0.11.10.1)&lt;/li&gt;
&lt;li&gt;JVM settings: -server -XX:+UseNUMA -XX:+UseCondCardMark -Xms1024M -Xmx2048M -Xss1M -XX:MaxPermSize=128m -XX:+UseParallelGC&lt;/li&gt;
&lt;li&gt;Akka version: 2.0-M4&lt;/li&gt;
&lt;li&gt;Dispatcher configuration other than default:&lt;br/&gt;core-pool-size:48 of thread-pool-exector&lt;br/&gt;parallelism:48 of fork-join-exector&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;When using thread pool executor (java.util.concurrent.ThreadPoolExecutor) the benchmark didn&amp;#8217;t scale beyond 12 parallel actors. Throughput was stuck at 1.4 million messages per second and didn&amp;#8217;t increase with added load even though the 48 core box at a first glance was not heavily loaded, less than 10% of total cpu capacity was used.&lt;/p&gt;
&lt;p&gt;&lt;img src="http://media.tumblr.com/tumblr_lzdwbkNTly1r4xnid.png"/&gt;&lt;/p&gt;
&lt;p&gt;First we thought the BIOS configuration was wrong, since the machine was new, but after going through all settings and turning off all power savings options the result was still as bad. We also bought more memory, to use 4 DIMMs per CPU for maximum memory bandwidth.&lt;/p&gt;
&lt;p&gt;We noticed that the number of context switches was abnormal, above 70000 per second.&lt;/p&gt;
&lt;p&gt;&lt;img src="http://media.tumblr.com/tumblr_lzdy67poym1r4xnid.png"/&gt;&lt;/p&gt;
&lt;p&gt;That must be the problem, but what is causing it? Viktor came up with the qualified guess that it must be the task queue of the thread pool executor, since that is shared and the locks in the LinkedBlockingQueue could potentially generate the context switches when there is contention.&lt;/p&gt;
&lt;p&gt;Discussions with Doug Lea resulted in an improved implementation of the fork join pool, which we have embedded in akka-actor, and is used by default. The task queue is striped using randomized queuing and stealing. Read more about it &lt;a href="http://cs.oswego.edu/pipermail/concurrency-interest/2012-January/008987.html"&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;When running the same benchmark with the fork-join-executor the context switches were normal, around 1300 per second.&lt;/p&gt;
&lt;p&gt;&lt;img src="http://media.tumblr.com/tumblr_lzdz39lOm61r4xnid.png"/&gt;&lt;/p&gt;
&lt;p&gt;The results of the benchmark illustrates that the throughput scales with number of actors up to the number of cores (48) and saturates at around 20 million messages per second.&lt;/p&gt;
&lt;p&gt;&lt;img src="http://media.tumblr.com/tumblr_lzdwci2U1a1r4xnid.png"/&gt;&lt;/p&gt;
&lt;p&gt;There are several things that can be tuned to achieve even higher throughput, which we will describe in follow up blog posts.&lt;/p&gt;</description><link>http://letitcrash.com/post/17607272336</link><guid>http://letitcrash.com/post/17607272336</guid><pubDate>Tue, 14 Feb 2012 15:42:00 +0100</pubDate><category>akka</category><category>benchmark</category><category>Author: Patrik Nordwall</category><dc:creator>patriknw</dc:creator></item><item><title>Akka 2.0 Remoting with Java</title><description>&lt;p&gt;There have been a lot of requests for a Java example of how to use the remoting capabilities in Akka 2.0 and now there is one. It can be found here:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://github.com/jboner/akka/tree/master/akka-samples/akka-sample-remote%20%20"&gt;&lt;a href="https://github.com/jboner/akka/tree/master/akka-samples/akka-sample-remote"&gt;https://github.com/jboner/akka/tree/master/akka-samples/akka-sample-remote&lt;/a&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Some interesting highlights are:&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Looking up a remote actor on a remote node&lt;/strong&gt;:&lt;/p&gt;
&lt;script src="https://gist.github.com/1539451.js?file=gistfile1.java"&gt;&lt;/script&gt;&lt;p&gt;&lt;strong&gt;Creating an actor on a remote node:&lt;/strong&gt;&lt;/p&gt;
&lt;script src="https://gist.github.com/1539458.js?file=gistfile1.java"&gt;&lt;/script&gt;&lt;p&gt;As you can see there isn&amp;#8217;t much to the code itself and this is because everything is configuration driven.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Here is what the configration files look like:&lt;/strong&gt;&lt;/p&gt;
&lt;script src="https://gist.github.com/1539478.js?file=gistfile1.txt"&gt;&lt;/script&gt;&lt;p&gt;and&lt;/p&gt;
&lt;script src="https://gist.github.com/1539480.js?file=gistfile1.txt"&gt;&lt;/script&gt;&lt;p&gt;That&amp;#8217;s it! Pretty slick right.&lt;/p&gt;
&lt;p&gt;Happy hAKKing&lt;/p&gt;
&lt;p&gt;//h3nk3&lt;/p&gt;</description><link>http://letitcrash.com/post/16813779762</link><guid>http://letitcrash.com/post/16813779762</guid><pubDate>Tue, 31 Jan 2012 11:38:00 +0100</pubDate><category>Author: Henrik Engström</category><category>submission</category><dc:creator>jonasboner</dc:creator></item><item><title>Benchmark: Akka vs Erlang</title><description>&lt;p&gt;&lt;a href="http://uberblo.gs"&gt;Franz Bettag&lt;/a&gt; have written up a small post about a benchmark between Akka and Erlang.&lt;/p&gt;
&lt;p&gt;Interesting results. On his hardware and specific benchmark Erlang R14B04 did &lt;strong&gt;1 million&lt;/strong&gt; messages per second while Akka 2.0-SNAPSHOT did &lt;strong&gt;2.1 million&lt;/strong&gt; per second.&lt;/p&gt;
&lt;p&gt;Read more here: &lt;a href="http://uberblo.gs/2011/12/scala-akka-and-erlang-actor-benchmarks"&gt;&lt;a href="http://uberblo.gs/2011/12/scala-akka-and-erlang-actor-benchmarks"&gt;http://uberblo.gs/2011/12/scala-akka-and-erlang-actor-benchmarks&lt;/a&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;#8230;and we still have a &lt;a href="http://www.assembla.com/spaces/akka/milestones/765763-performance"&gt;lot more performance&lt;/a&gt; to squeeze out of Akka.&lt;/p&gt;</description><link>http://letitcrash.com/post/14783691760</link><guid>http://letitcrash.com/post/14783691760</guid><pubDate>Mon, 26 Dec 2011 00:33:45 +0100</pubDate><category>Author: Jonas Bonér</category><dc:creator>jonasboner</dc:creator></item><item><title>Location Transparency: Remoting in Akka 2.0</title><description>&lt;p&gt;The &lt;a href="http://akka.io/docs/akka/2.0-M1/general/remoting.html"&gt;remoting capabilities&lt;/a&gt; of &lt;a href="http://akka.io/docs/akka/2.0-M1/"&gt;Akka 2.0&lt;/a&gt; are really powerful. Something that not has been as powerful is the documentation of the Akka remoting. We are constantly striving on improving it and this blog post will, hopefully, shed some light on the topic.&lt;br/&gt;&lt;br/&gt;The remoting contains functionality not only to lookup a remote actor and send messages to it but also to deploy actors on remote nodes. These two types of interaction are referred to as:&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;Lookup&lt;/li&gt;
&lt;li&gt;Creation&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;In the section below the two different approaches will be explained.&lt;br/&gt;(It may be worth pointing out that a combination of the two ways is, of course, also feasible)&lt;br/&gt;&lt;br/&gt;&lt;strong&gt;The Setup&lt;/strong&gt;&lt;br/&gt;&lt;br/&gt;In order to run the example code below the following jars must be available on your classpath:&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;akka-actor.jar&lt;/li&gt;
&lt;li&gt;akka-remote.jar&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;&lt;strong&gt;The Configuration File&lt;/strong&gt;&lt;br/&gt;&lt;br/&gt;Firstly we&amp;#8217;ll start off by examining the configuration file as it plays a pivotal part in the remoting. The remote section holds a lot of configuration possibilities but the bare minimum to get started is described in this section:&lt;br/&gt;&lt;script src="https://gist.github.com/1511530.js?file=application"&gt;&lt;/script&gt;&lt;br/&gt;&lt;br/&gt;If you want to run multiple actor systems on the same machine you can group your settings like this:&lt;br/&gt;&lt;script src="https://gist.github.com/1511548.js?file=application.conf"&gt;&lt;/script&gt;&lt;br/&gt;&lt;br/&gt;Okay, so basically what you need to do to get started are four things:&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;Make sure that the &lt;code&gt;akka.remote.RemoteActorRefProvider&lt;/code&gt; is used as provider&lt;/li&gt;
&lt;li&gt;Add host name - the machine you want to run the actor system on&lt;/li&gt;
&lt;li&gt;Add port number - the port the actor system should listen on&lt;/li&gt;
&lt;li&gt;Add cluster node name - must be a unique name in the cluster&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;The above settings are enough for the lookup approach. In that case we only need to make sure the involved actor system run on a unique combination of host name and port.&lt;br/&gt;&lt;br/&gt;Let&amp;#8217;s say we are interested in testing the other approach, i.e. the creation functionality of remoting. This means that we have to add some information to the configuration file:&lt;br/&gt;&lt;script src="https://gist.github.com/1511553.js?file=gistfile1.txt"&gt;&lt;/script&gt;&lt;br/&gt;&lt;br/&gt;The configuration above instructs Akka to react specially once when an actor at path &lt;code&gt;/actorName&lt;/code&gt; is created, i.e. using &lt;code&gt;system.actorOf(Props(...), "actorName")&lt;/code&gt;. This specific actor will not only be instantiated, but instead the remote daemon of the remote system will be asked to create the actor instead,which is at &lt;code&gt;actorSystem@127.0.0.1:2553&lt;/code&gt; in this sample.&lt;br/&gt;&lt;br/&gt;&lt;strong&gt;Lookup Approach in code&lt;/strong&gt;&lt;br/&gt;&lt;br/&gt;Let&amp;#8217;s say you want to look up an actor on a remote node and use it. It&amp;#8217;s really simple! Just do the following:&lt;br/&gt;&lt;code&gt;context.actorFor("akka://ACTOR_SYSTEM@HOST:PORT/user/ACTOR_NAME")&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;where:&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;&lt;code&gt;ACTOR_SYSTEM&lt;/code&gt; is the name of the actor system the actor exists in&lt;/li&gt;
&lt;li&gt;&lt;code&gt;HOST&lt;/code&gt; is the machine address, e.g. &lt;code&gt;127.0.0.1&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;PORT&lt;/code&gt; is the port number the actor system is configured to listen to, e.g. 2552&lt;/li&gt;
&lt;li&gt;&lt;code&gt;ACTOR_NAME&lt;/code&gt; is the name of the actor you want to use&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;The actor you want to use has to exist in the actor system and have the name associated with it. Here&amp;#8217;s some example code how to set it up and try it out:&lt;br/&gt;&lt;script src="https://gist.github.com/1511728.js?file=gistfile1.scala"&gt;&lt;/script&gt;&lt;br/&gt;&lt;br/&gt;&lt;strong&gt;Creation Approach in code&lt;/strong&gt;&lt;br/&gt;&lt;br/&gt;In this section we will see how to create and use and actor on a remote node:&lt;br/&gt;&lt;script src="https://gist.github.com/1511732.js?file=gistfile1.scala"&gt;&lt;/script&gt;&lt;br/&gt;&lt;br/&gt;A fully fledged example of the two approaches can also be found here:&lt;br/&gt;&lt;a href="https://github.com/jboner/akka/tree/master/akka-samples/akka-sample-remote"&gt;&lt;a href="https://github.com/jboner/akka/tree/master/akka-samples/akka-sample-remote"&gt;https://github.com/jboner/akka/tree/master/akka-samples/akka-sample-remote&lt;/a&gt;&lt;br/&gt;&lt;/a&gt;&lt;br/&gt;Happy hAKKing&lt;br/&gt;&lt;a href="https://twitter.com/#!/h3nk3"&gt;@h3nk3&lt;/a&gt;&lt;/p&gt;</description><link>http://letitcrash.com/post/14630948149</link><guid>http://letitcrash.com/post/14630948149</guid><pubDate>Thu, 22 Dec 2011 21:45:00 +0100</pubDate><category>Author: Henrik Engström</category><category>submission</category><dc:creator>jonasboner</dc:creator></item><item><title>Running Akka on ARM7 with 100 requests per second</title><description>&lt;p&gt;&lt;a href="https://twitter.com/#!/honzam399" title="@honzam399" target="_blank"&gt;@honzam399&lt;/a&gt; &lt;a href="http://t.co/JoaYpm5d"&gt;writes&lt;/a&gt;:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&amp;#8220;#Akka on ARM7 board, processing 100 simple REST requests/s at 5&amp;#160;V, 500&amp;#160;mA!&amp;#8221;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;img src="http://desmond.yfrog.com/Himg612/scaled.php?tn=0&amp;amp;server=612&amp;amp;filename=p0syo.jpg&amp;amp;xsize=640&amp;amp;ysize=640"/&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src="http://desmond.yfrog.com/Himg814/scaled.php?tn=0&amp;amp;server=814&amp;amp;filename=ipe.png&amp;amp;xsize=640&amp;amp;ysize=640"/&gt;&lt;/p&gt;</description><link>http://letitcrash.com/post/14562863769</link><guid>http://letitcrash.com/post/14562863769</guid><pubDate>Wed, 21 Dec 2011 15:24:00 +0100</pubDate><category>Author: Viktor Klang</category><category>submission</category><dc:creator>klangism</dc:creator></item><item><title>Fun running Akka tests in parallel on my 24 core Linux box. 
sbt...</title><description>&lt;img src="http://24.media.tumblr.com/tumblr_lwijb8vhjc1r8ba2yo1_500.png"/&gt;&lt;br/&gt;&lt;br/&gt;&lt;p&gt;Fun running Akka tests in parallel on my 24 core Linux box. &lt;/p&gt;
&lt;p&gt;sbt parallel testing FTW. &lt;/p&gt;</description><link>http://letitcrash.com/post/14515696979</link><guid>http://letitcrash.com/post/14515696979</guid><pubDate>Tue, 20 Dec 2011 18:30:44 +0100</pubDate><category>Author: Jonas Bonér</category><dc:creator>jonasboner</dc:creator></item><item><title>Akka Team Blog Is Live</title><description>&lt;p&gt;Stay tuned for more soon&amp;#8230; :-P&lt;/p&gt;</description><link>http://letitcrash.com/post/14464552534</link><guid>http://letitcrash.com/post/14464552534</guid><pubDate>Mon, 19 Dec 2011 23:58:00 +0100</pubDate><category>Author: Jonas Bonér</category><dc:creator>jonasboner</dc:creator></item></channel></rss>

