{"action":"created","comment":{"url":"https://api.github.com/repos/akka/akka/pulls/comments/65041522","id":65041522,"diff_hunk":"@@ -0,0 +1,90 @@\n+/**\n+ * Copyright (C) 2016 Lightbend Inc. <http://www.lightbend.com>\n+ */\n+package akka.remote.artery\n+\n+import akka.stream.stage.GraphStage\n+import akka.stream.stage.OutHandler\n+import akka.stream.Attributes\n+import akka.stream.Outlet\n+import akka.stream.SourceShape\n+import akka.stream.stage.GraphStageLogic\n+import org.agrona.concurrent.ManyToOneConcurrentArrayQueue\n+import akka.stream.stage.GraphStageWithMaterializedValue\n+import org.agrona.concurrent.ManyToOneConcurrentLinkedQueueTail\n+import org.agrona.concurrent.ManyToOneConcurrentLinkedQueue\n+import java.util.concurrent.atomic.AtomicInteger\n+\n+/**\n+ * INTERNAL API\n+ */\n+private[remote] object SendQueue {\n+  trait OfferApi[T] {\n+    def offer(message: T): Boolean\n+  }\n+\n+  private trait WakeupSignal {\n+    def wakeup(): Unit\n+  }\n+}\n+\n+/**\n+ * INTERNAL API\n+ */\n+private[remote] final class SendQueue[T](capacity: Int) extends GraphStageWithMaterializedValue[SourceShape[T], SendQueue.OfferApi[T]] {\n+  import SendQueue._\n+\n+  val out: Outlet[T] = Outlet(\"SendQueue.out\")\n+  override val shape: SourceShape[T] = SourceShape(out)\n+\n+  override def createLogicAndMaterializedValue(inheritedAttributes: Attributes): (GraphStageLogic, OfferApi[T]) = {\n+    @volatile var needWakeup = false\n+    val queue = new ManyToOneConcurrentArrayQueue[T](capacity)\n+    // TODO perhaps try similar with ManyToOneConcurrentLinkedQueue or AbstractNodeQueue\n+\n+    val logic = new GraphStageLogic(shape) with OutHandler with WakeupSignal {\n+      private val wakeupCallback = getAsyncCallback[Unit] { _ ⇒\n+        if (isAvailable(out))\n+          tryPush()\n+      }\n+\n+      override def onPull(): Unit =\n+        tryPush()\n+\n+      private def tryPush(): Unit = {\n+        needWakeup = true","path":"akka-remote/src/main/scala/akka/remote/artery/SendQueue.scala","position":55,"original_position":55,"commit_id":"9cafc7388e5d6dd4b794f1acac4d685b7716e381","original_commit_id":"9cafc7388e5d6dd4b794f1acac4d685b7716e381","user":{"login":"patriknw","id":336161,"avatar_url":"https://avatars.githubusercontent.com/u/336161?v=3","gravatar_id":"","url":"https://api.github.com/users/patriknw","html_url":"https://github.com/patriknw","followers_url":"https://api.github.com/users/patriknw/followers","following_url":"https://api.github.com/users/patriknw/following{/other_user}","gists_url":"https://api.github.com/users/patriknw/gists{/gist_id}","starred_url":"https://api.github.com/users/patriknw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/patriknw/subscriptions","organizations_url":"https://api.github.com/users/patriknw/orgs","repos_url":"https://api.github.com/users/patriknw/repos","events_url":"https://api.github.com/users/patriknw/events{/privacy}","received_events_url":"https://api.github.com/users/patriknw/received_events","type":"User","site_admin":false},"body":"good suggestion, I'll try that\r\nI'll try that.\r\nI'll also write a randomized stress test to exercise the scenario.","created_at":"2016-05-30T08:38:57Z","updated_at":"2016-05-30T08:38:57Z","html_url":"https://github.com/akka/akka/pull/20657#discussion_r65041522","pull_request_url":"https://api.github.com/repos/akka/akka/pulls/20657","_links":{"self":{"href":"https://api.github.com/repos/akka/akka/pulls/comments/65041522"},"html":{"href":"https://github.com/akka/akka/pull/20657#discussion_r65041522"},"pull_request":{"href":"https://api.github.com/repos/akka/akka/pulls/20657"}}},"pull_request":{"url":"https://api.github.com/repos/akka/akka/pulls/20657","id":71836881,"html_url":"https://github.com/akka/akka/pull/20657","diff_url":"https://github.com/akka/akka/pull/20657.diff","patch_url":"https://github.com/akka/akka/pull/20657.patch","issue_url":"https://api.github.com/repos/akka/akka/issues/20657","number":20657,"state":"open","locked":false,"title":"jmh benchmark for send queue","user":{"login":"patriknw","id":336161,"avatar_url":"https://avatars.githubusercontent.com/u/336161?v=3","gravatar_id":"","url":"https://api.github.com/users/patriknw","html_url":"https://github.com/patriknw","followers_url":"https://api.github.com/users/patriknw/followers","following_url":"https://api.github.com/users/patriknw/following{/other_user}","gists_url":"https://api.github.com/users/patriknw/gists{/gist_id}","starred_url":"https://api.github.com/users/patriknw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/patriknw/subscriptions","organizations_url":"https://api.github.com/users/patriknw/orgs","repos_url":"https://api.github.com/users/patriknw/repos","events_url":"https://api.github.com/users/patriknw/events{/privacy}","received_events_url":"https://api.github.com/users/patriknw/received_events","type":"User","site_admin":false},"body":"* new SendQueue Source based on agrona ManyToOneConcurrentArrayQueue\r\n* JMH benchmark for Source.queue, Source.actorRef and the new SendQueue\r\n\r\n```\r\n[info] Benchmark                                                       Mode  Cnt     Score      Error   Units\r\n[info] SendQueueBenchmark.actorRef                                    thrpt   20   851.698 ±  146.260  ops/ms\r\n[info] SendQueueBenchmark.actorRef:·gc.alloc.rate                     thrpt   20   145.674 ±   25.134  MB/sec\r\n[info] SendQueueBenchmark.queue                                       thrpt   20  1651.769 ±  309.520  ops/ms\r\n[info] SendQueueBenchmark.queue:·gc.alloc.rate                        thrpt   20   278.663 ±   52.128  MB/sec\r\n[info] SendQueueBenchmark.sendQueue                                   thrpt   20  4769.884 ± 1179.381  ops/ms\r\n[info] SendQueueBenchmark.sendQueue:·gc.alloc.rate                    thrpt   20   144.605 ±   27.811  MB/sec\r\n```","created_at":"2016-05-29T20:28:47Z","updated_at":"2016-05-30T08:38:57Z","closed_at":null,"merged_at":null,"merge_commit_sha":"22f7f43cdac9b1d84cbac41e2c269f1e5d8f94da","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/akka/akka/pulls/20657/commits","review_comments_url":"https://api.github.com/repos/akka/akka/pulls/20657/comments","review_comment_url":"https://api.github.com/repos/akka/akka/pulls/comments{/number}","comments_url":"https://api.github.com/repos/akka/akka/issues/20657/comments","statuses_url":"https://api.github.com/repos/akka/akka/statuses/9cafc7388e5d6dd4b794f1acac4d685b7716e381","head":{"label":"akka:wip-send-queue-patrikwn","ref":"wip-send-queue-patrikwn","sha":"9cafc7388e5d6dd4b794f1acac4d685b7716e381","user":{"login":"akka","id":1496237,"avatar_url":"https://avatars.githubusercontent.com/u/1496237?v=3","gravatar_id":"","url":"https://api.github.com/users/akka","html_url":"https://github.com/akka","followers_url":"https://api.github.com/users/akka/followers","following_url":"https://api.github.com/users/akka/following{/other_user}","gists_url":"https://api.github.com/users/akka/gists{/gist_id}","starred_url":"https://api.github.com/users/akka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/akka/subscriptions","organizations_url":"https://api.github.com/users/akka/orgs","repos_url":"https://api.github.com/users/akka/repos","events_url":"https://api.github.com/users/akka/events{/privacy}","received_events_url":"https://api.github.com/users/akka/received_events","type":"Organization","site_admin":false},"repo":{"id":130013,"name":"akka","full_name":"akka/akka","owner":{"login":"akka","id":1496237,"avatar_url":"https://avatars.githubusercontent.com/u/1496237?v=3","gravatar_id":"","url":"https://api.github.com/users/akka","html_url":"https://github.com/akka","followers_url":"https://api.github.com/users/akka/followers","following_url":"https://api.github.com/users/akka/following{/other_user}","gists_url":"https://api.github.com/users/akka/gists{/gist_id}","starred_url":"https://api.github.com/users/akka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/akka/subscriptions","organizations_url":"https://api.github.com/users/akka/orgs","repos_url":"https://api.github.com/users/akka/repos","events_url":"https://api.github.com/users/akka/events{/privacy}","received_events_url":"https://api.github.com/users/akka/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/akka/akka","description":"Akka Project","fork":false,"url":"https://api.github.com/repos/akka/akka","forks_url":"https://api.github.com/repos/akka/akka/forks","keys_url":"https://api.github.com/repos/akka/akka/keys{/key_id}","collaborators_url":"https://api.github.com/repos/akka/akka/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/akka/akka/teams","hooks_url":"https://api.github.com/repos/akka/akka/hooks","issue_events_url":"https://api.github.com/repos/akka/akka/issues/events{/number}","events_url":"https://api.github.com/repos/akka/akka/events","assignees_url":"https://api.github.com/repos/akka/akka/assignees{/user}","branches_url":"https://api.github.com/repos/akka/akka/branches{/branch}","tags_url":"https://api.github.com/repos/akka/akka/tags","blobs_url":"https://api.github.com/repos/akka/akka/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/akka/akka/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/akka/akka/git/refs{/sha}","trees_url":"https://api.github.com/repos/akka/akka/git/trees{/sha}","statuses_url":"https://api.github.com/repos/akka/akka/statuses/{sha}","languages_url":"https://api.github.com/repos/akka/akka/languages","stargazers_url":"https://api.github.com/repos/akka/akka/stargazers","contributors_url":"https://api.github.com/repos/akka/akka/contributors","subscribers_url":"https://api.github.com/repos/akka/akka/subscribers","subscription_url":"https://api.github.com/repos/akka/akka/subscription","commits_url":"https://api.github.com/repos/akka/akka/commits{/sha}","git_commits_url":"https://api.github.com/repos/akka/akka/git/commits{/sha}","comments_url":"https://api.github.com/repos/akka/akka/comments{/number}","issue_comment_url":"https://api.github.com/repos/akka/akka/issues/comments{/number}","contents_url":"https://api.github.com/repos/akka/akka/contents/{+path}","compare_url":"https://api.github.com/repos/akka/akka/compare/{base}...{head}","merges_url":"https://api.github.com/repos/akka/akka/merges","archive_url":"https://api.github.com/repos/akka/akka/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/akka/akka/downloads","issues_url":"https://api.github.com/repos/akka/akka/issues{/number}","pulls_url":"https://api.github.com/repos/akka/akka/pulls{/number}","milestones_url":"https://api.github.com/repos/akka/akka/milestones{/number}","notifications_url":"https://api.github.com/repos/akka/akka/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/akka/akka/labels{/name}","releases_url":"https://api.github.com/repos/akka/akka/releases{/id}","deployments_url":"https://api.github.com/repos/akka/akka/deployments","created_at":"2009-02-16T12:51:54Z","updated_at":"2016-05-29T18:42:55Z","pushed_at":"2016-05-30T07:42:11Z","git_url":"git://github.com/akka/akka.git","ssh_url":"git@github.com:akka/akka.git","clone_url":"https://github.com/akka/akka.git","svn_url":"https://github.com/akka/akka","homepage":"http://akka.io","size":232433,"stargazers_count":5572,"watchers_count":5572,"language":"Scala","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1735,"mirror_url":null,"open_issues_count":703,"forks":1735,"open_issues":703,"watchers":5572,"default_branch":"master"}},"base":{"label":"akka:artery-dev","ref":"artery-dev","sha":"9c586577a30c43496cee0721e2d94177ee259209","user":{"login":"akka","id":1496237,"avatar_url":"https://avatars.githubusercontent.com/u/1496237?v=3","gravatar_id":"","url":"https://api.github.com/users/akka","html_url":"https://github.com/akka","followers_url":"https://api.github.com/users/akka/followers","following_url":"https://api.github.com/users/akka/following{/other_user}","gists_url":"https://api.github.com/users/akka/gists{/gist_id}","starred_url":"https://api.github.com/users/akka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/akka/subscriptions","organizations_url":"https://api.github.com/users/akka/orgs","repos_url":"https://api.github.com/users/akka/repos","events_url":"https://api.github.com/users/akka/events{/privacy}","received_events_url":"https://api.github.com/users/akka/received_events","type":"Organization","site_admin":false},"repo":{"id":130013,"name":"akka","full_name":"akka/akka","owner":{"login":"akka","id":1496237,"avatar_url":"https://avatars.githubusercontent.com/u/1496237?v=3","gravatar_id":"","url":"https://api.github.com/users/akka","html_url":"https://github.com/akka","followers_url":"https://api.github.com/users/akka/followers","following_url":"https://api.github.com/users/akka/following{/other_user}","gists_url":"https://api.github.com/users/akka/gists{/gist_id}","starred_url":"https://api.github.com/users/akka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/akka/subscriptions","organizations_url":"https://api.github.com/users/akka/orgs","repos_url":"https://api.github.com/users/akka/repos","events_url":"https://api.github.com/users/akka/events{/privacy}","received_events_url":"https://api.github.com/users/akka/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/akka/akka","description":"Akka Project","fork":false,"url":"https://api.github.com/repos/akka/akka","forks_url":"https://api.github.com/repos/akka/akka/forks","keys_url":"https://api.github.com/repos/akka/akka/keys{/key_id}","collaborators_url":"https://api.github.com/repos/akka/akka/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/akka/akka/teams","hooks_url":"https://api.github.com/repos/akka/akka/hooks","issue_events_url":"https://api.github.com/repos/akka/akka/issues/events{/number}","events_url":"https://api.github.com/repos/akka/akka/events","assignees_url":"https://api.github.com/repos/akka/akka/assignees{/user}","branches_url":"https://api.github.com/repos/akka/akka/branches{/branch}","tags_url":"https://api.github.com/repos/akka/akka/tags","blobs_url":"https://api.github.com/repos/akka/akka/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/akka/akka/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/akka/akka/git/refs{/sha}","trees_url":"https://api.github.com/repos/akka/akka/git/trees{/sha}","statuses_url":"https://api.github.com/repos/akka/akka/statuses/{sha}","languages_url":"https://api.github.com/repos/akka/akka/languages","stargazers_url":"https://api.github.com/repos/akka/akka/stargazers","contributors_url":"https://api.github.com/repos/akka/akka/contributors","subscribers_url":"https://api.github.com/repos/akka/akka/subscribers","subscription_url":"https://api.github.com/repos/akka/akka/subscription","commits_url":"https://api.github.com/repos/akka/akka/commits{/sha}","git_commits_url":"https://api.github.com/repos/akka/akka/git/commits{/sha}","comments_url":"https://api.github.com/repos/akka/akka/comments{/number}","issue_comment_url":"https://api.github.com/repos/akka/akka/issues/comments{/number}","contents_url":"https://api.github.com/repos/akka/akka/contents/{+path}","compare_url":"https://api.github.com/repos/akka/akka/compare/{base}...{head}","merges_url":"https://api.github.com/repos/akka/akka/merges","archive_url":"https://api.github.com/repos/akka/akka/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/akka/akka/downloads","issues_url":"https://api.github.com/repos/akka/akka/issues{/number}","pulls_url":"https://api.github.com/repos/akka/akka/pulls{/number}","milestones_url":"https://api.github.com/repos/akka/akka/milestones{/number}","notifications_url":"https://api.github.com/repos/akka/akka/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/akka/akka/labels{/name}","releases_url":"https://api.github.com/repos/akka/akka/releases{/id}","deployments_url":"https://api.github.com/repos/akka/akka/deployments","created_at":"2009-02-16T12:51:54Z","updated_at":"2016-05-29T18:42:55Z","pushed_at":"2016-05-30T07:42:11Z","git_url":"git://github.com/akka/akka.git","ssh_url":"git@github.com:akka/akka.git","clone_url":"https://github.com/akka/akka.git","svn_url":"https://github.com/akka/akka","homepage":"http://akka.io","size":232433,"stargazers_count":5572,"watchers_count":5572,"language":"Scala","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1735,"mirror_url":null,"open_issues_count":703,"forks":1735,"open_issues":703,"watchers":5572,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/akka/akka/pulls/20657"},"html":{"href":"https://github.com/akka/akka/pull/20657"},"issue":{"href":"https://api.github.com/repos/akka/akka/issues/20657"},"comments":{"href":"https://api.github.com/repos/akka/akka/issues/20657/comments"},"review_comments":{"href":"https://api.github.com/repos/akka/akka/pulls/20657/comments"},"review_comment":{"href":"https://api.github.com/repos/akka/akka/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/akka/akka/pulls/20657/commits"},"statuses":{"href":"https://api.github.com/repos/akka/akka/statuses/9cafc7388e5d6dd4b794f1acac4d685b7716e381"}}}}
{"actor":{"display_login":"patriknw"}}