This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private def probeActorRef(sel: ActorSelection): Unit = { | |
| import scala.util.{Success, Failure} | |
| import scala.concurrent.ExecutionContext.Implicits.global | |
| import akka.util.Timeout | |
| import scala.concurrent.duration._ | |
| implicit val timeout = Timeout(300.millis) // Timeout for the resolveOne call | |
| sel.resolveOne().onComplete { | |
| case Success(ref) => |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import akka.actor._ | |
| import com.typesafe.scalalogging.slf4j.StrictLogging | |
| /** DeadLetterを監視するactor | |
| */ | |
| object DeadLetterWatcher { | |
| val actorName = "dead_letter_watcher" | |
| def props(): Props = Props(new DeadLetterWatcher) | |
| def apply(context: ActorRefFactory): ActorRef = context.actorOf(props(), actorName) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| scalaVersion := "2.11.2" | |
| libraryDependencies ++= { | |
| val v = "0.8.1" | |
| ("com.typesafe.akka" %% "akka-remote" % "2.3.5") :: | |
| ("org.scalaz" %% "scalaz-core" % "7.1.0") :: | |
| ("net.databinder" %% "unfiltered-jetty" % v) :: | |
| ("net.databinder" %% "unfiltered-filter" % v) :: | |
| ("com.chuusai" %% "shapeless" % "2.0.0") :: | |
| ("com.github.nscala-time" %% "nscala-time" % "1.4.0") :: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package study | |
| /** gatling-2.0.0-RC3 | |
| * @example{ | |
| * ./bin/gatling.sh -nr -s study.InspectSession | |
| * } | |
| */ | |
| import io.gatling.core.Predef._ | |
| import io.gatling.http.Predef._ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package study | |
| /** gatling-2.0.0-RC3 | |
| * @example{ | |
| * ./bin/gatling.sh -nr -s study.UseAkkaActor | |
| * } | |
| */ | |
| import io.gatling.core.Predef._ | |
| import io.gatling.http.Predef._ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 17:39:00.605 [WARN ] i.g.h.a.AsyncHandlerActor - Request '/v1/jsevents' failed: java.lang.NullPointerException | |
| [ERROR] [09/09/2014 17:39:00.642] [GatlingSystem-akka.actor.default-dispatcher-14] [akka://GatlingSystem/user/$h] null | |
| java.io.IOException | |
| at com.ning.http.client.providers.netty.request.NettyRequestSender.sendRequestWithCachedChannel(NettyRequestSender.java:222) | |
| at com.ning.http.client.providers.netty.request.NettyRequestSender.sendRequestWithCertainForceConnect(NettyRequestSender.java:136) | |
| at com.ning.http.client.providers.netty.request.NettyRequestSender.sendRequest(NettyRequestSender.java:113) | |
| at com.ning.http.client.providers.netty.NettyAsyncHttpProvider.execute(NettyAsyncHttpProvider.java:86) | |
| at com.ning.http.client.AsyncHttpClient.executeRequest(AsyncHttpClient.java:491) | |
| at io.gatling.http.ahc.HttpEngine.startHttpTransaction(HttpEngine.scala:249) | |
| at io.gatling.http.action.HttpRequestAction$.startHttpTransaction$1(HttpRequestAction.scala:3 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import io.gatling.core.Predef._ | |
| import io.gatling.http.Predef._ | |
| import io.gatling.jdbc.Predef._ | |
| class Repeat extends Simulation { | |
| val httpProtocol = http.baseURL("http://localhost").inferHtmlResources() | |
| val scn = scenario("repeat test").repeat(10) { exec(http("Home").get("/")) } | |
| setUp(scn.inject(rampUsers(10) over(1)).protocols(httpProtocol)) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| stop: 現在処理中のメッセージを完了させる。それ以外のMailboxに溜まっているメッセージは処理しない | |
| PoisonPill: メッセージの追加なので、投げた時点でたまっているメッセージが処理される (キュー消化+stop) | |
| kill: ActorKilledExceptionが速攻出る(処理中の動作を破棄?)。その後はsupervisorのstrategyに依存(default:stop)。Mailboxはそのまま残る(restartしたactorが継続) | |
| http://stackoverflow.com/questions/13847963/akka-kill-vs-stop-vs-poison-pill |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import io.gatling.core.Predef._ | |
| import io.gatling.http.Predef._ | |
| class Maiha extends Simulation { | |
| val top = | |
| exec(http("gatling.io") | |
| .get("/") | |
| .check(regex("""href="(.*?)"""").saveAs("url")) // should be "/assets/images/favicon.ico" | |
| ) | |
| .exec(http("1st link") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| a) akka.actor.Scheduler | |
| * akka bundle | |
| * 生akka系 | |
| * 永続化: なし | |
| * 使用例: 'system.scheduler.scheduleOnce(8 hours, self, StartDeliveryWorkers)' | |
| * akka: 2.3 ready | |
| * 開発: 活発 (akkaに依存) | |
| b) akka-quartz-scheduler | |
| * https://github.com/enragedginger/akka-quartz-scheduler |