<?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>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’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’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, &lt;insert your favorite IDE here&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;&gt; git clone git@github.com:henrikengstrom/PlayMiniSample.git&lt;/em&gt;&lt;br/&gt;&lt;em&gt;&gt; cd PlayMiniSample&lt;/em&gt;&lt;br/&gt;&lt;em&gt;&gt; sbt&lt;/em&gt;&lt;br/&gt;&lt;em&gt;sbt&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 /&lt;your_structure&gt;/PlayMiniSample/target/scala-2.9.1/classes…&lt;/em&gt;&lt;br/&gt;&lt;em&gt;[success] Total time: 5 s, completed Feb 19, 2012 10:31:41 AM&lt;/em&gt;&lt;br/&gt;&lt;br/&gt;Okay, that’s it. Now you have the code downloaded and compiled. &lt;br/&gt;Before giving the application a spin it’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(“/ping”)) or&lt;/em&gt;&lt;br/&gt;&lt;em&gt;POST(Path(“/write”))&lt;/em&gt;&lt;br/&gt;&lt;br/&gt;The result returned is a “Action”. 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’s dissect the HTTP POST in the sample.&lt;/p&gt;
&lt;script src="https://gist.github.com/1863329.js?file=gistfile1.scala"&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 “implicit request”. 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 “shakespeare ? numberMonkeys”. This returns an Akka Future instance and that Future is then mapped to the case class “Result”. (The rest of the code, i.e. “.asPromise.map” is merely a way of converting from an Akka Future into Play’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’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"&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 (“?”) 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 “sender” 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 “sender” 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;&gt;sbt&lt;/em&gt;&lt;br/&gt;&lt;em&gt;sbt&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…&lt;/em&gt;&lt;br/&gt;&lt;br/&gt;Fire up another terminal window and try it out:&lt;br/&gt;&lt;em&gt;&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’s get them monkeys busy:&lt;br/&gt;&lt;em&gt;&gt; curl -d “number=1” 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’s try with 100 monkeys:&lt;br/&gt;&lt;em&gt;&gt; curl -d “number=100” 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 “or”. Let’s use one thousand monkey and see what words they can come up with:&lt;br/&gt;&lt;em&gt;&gt; curl -d “number=1000” 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’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:09 +0100</pubDate><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’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 2.1 GHz Processors)&lt;/li&gt;
&lt;li&gt;Memory: 128 GB ECC DDR3 1333 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 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’t scale beyond 12 parallel actors. Throughput was stuck at 1.4 million messages per second and didn’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’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’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;…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’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’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’s say you want to look up an actor on a remote node and use it. It’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’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;“#Akka on ARM7 board, processing 100 simple REST requests/s at 5 V, 500 mA!”&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;img src="http://desmond.yfrog.com/Himg612/scaled.php?tn=0&amp;server=612&amp;filename=p0syo.jpg&amp;xsize=640&amp;ysize=640"/&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src="http://desmond.yfrog.com/Himg814/scaled.php?tn=0&amp;server=814&amp;filename=ipe.png&amp;xsize=640&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://30.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… :-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>

