{"action":"created","comment":{"url":"https://api.github.com/repos/infinispan/infinispan/pulls/comments/71497761","id":71497761,"diff_hunk":"@@ -0,0 +1,58 @@\n+package org.infinispan.server.router.router.impl.hotrod.handlers;\n+\n+import io.netty.buffer.ByteBuf;\n+import io.netty.channel.Channel;\n+import io.netty.channel.ChannelHandlerContext;\n+import io.netty.channel.ChannelInitializer;\n+import io.netty.handler.ssl.SniHandler;\n+import io.netty.handler.ssl.SslContext;\n+import io.netty.util.DomainNameMapping;\n+import org.infinispan.commons.logging.LogFactory;\n+import org.infinispan.server.router.RoutingTable;\n+import org.infinispan.server.router.logging.RouterLogger;\n+import org.infinispan.server.router.routes.hotrod.NettyHandlerRouteDestination;\n+import org.infinispan.server.router.routes.Route;\n+import org.infinispan.server.router.routes.SniRouteSource;\n+\n+import java.lang.invoke.MethodHandles;\n+import java.util.List;\n+import java.util.Optional;\n+\n+public class SniRouteHandler extends SniHandler {\n+\n+    private static final RouterLogger logger = LogFactory.getLog(MethodHandles.lookup().lookupClass(), RouterLogger.class);\n+\n+    private final RoutingTable routingTable;\n+\n+    public SniRouteHandler(DomainNameMapping<? extends SslContext> mapping, RoutingTable routingTable) {\n+        super(mapping);\n+        this.routingTable = routingTable;\n+    }\n+\n+    @Override\n+    protected void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) throws Exception {\n+        super.decode(ctx, in, out);\n+\n+        if(isHandShaked()) {\n+            // At this point Netty has replaced SNIHandler (formally this) with SSLHandler in the pipeline.\n+            // Now we need to add other handlers at the tail of the queue\n+            logger.debug(\"Handshaked with hostname \" + hostname());","path":"server/router/src/main/java/org/infinispan/server/router/router/impl/hotrod/handlers/SniRouteHandler.java","position":39,"original_position":39,"commit_id":"590123ff4bf1fdec0274ae4191bedf35ba6d5907","original_commit_id":"590123ff4bf1fdec0274ae4191bedf35ba6d5907","user":{"login":"slaskawi","id":8417158,"avatar_url":"https://avatars.githubusercontent.com/u/8417158?v=3","gravatar_id":"","url":"https://api.github.com/users/slaskawi","html_url":"https://github.com/slaskawi","followers_url":"https://api.github.com/users/slaskawi/followers","following_url":"https://api.github.com/users/slaskawi/following{/other_user}","gists_url":"https://api.github.com/users/slaskawi/gists{/gist_id}","starred_url":"https://api.github.com/users/slaskawi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/slaskawi/subscriptions","organizations_url":"https://api.github.com/users/slaskawi/orgs","repos_url":"https://api.github.com/users/slaskawi/repos","events_url":"https://api.github.com/users/slaskawi/events{/privacy}","received_events_url":"https://api.github.com/users/slaskawi/received_events","type":"User","site_admin":false},"body":"done","created_at":"2016-07-20T10:04:35Z","updated_at":"2016-07-20T10:04:35Z","html_url":"https://github.com/infinispan/infinispan/pull/4348#discussion_r71497761","pull_request_url":"https://api.github.com/repos/infinispan/infinispan/pulls/4348","_links":{"self":{"href":"https://api.github.com/repos/infinispan/infinispan/pulls/comments/71497761"},"html":{"href":"https://github.com/infinispan/infinispan/pull/4348#discussion_r71497761"},"pull_request":{"href":"https://api.github.com/repos/infinispan/infinispan/pulls/4348"}}},"pull_request":{"url":"https://api.github.com/repos/infinispan/infinispan/pulls/4348","id":70192049,"html_url":"https://github.com/infinispan/infinispan/pull/4348","diff_url":"https://github.com/infinispan/infinispan/pull/4348.diff","patch_url":"https://github.com/infinispan/infinispan/pull/4348.patch","issue_url":"https://api.github.com/repos/infinispan/infinispan/issues/4348","number":4348,"state":"open","locked":false,"title":"ISPN-6635 Multi tenancy","user":{"login":"slaskawi","id":8417158,"avatar_url":"https://avatars.githubusercontent.com/u/8417158?v=3","gravatar_id":"","url":"https://api.github.com/users/slaskawi","html_url":"https://github.com/slaskawi","followers_url":"https://api.github.com/users/slaskawi/followers","following_url":"https://api.github.com/users/slaskawi/following{/other_user}","gists_url":"https://api.github.com/users/slaskawi/gists{/gist_id}","starred_url":"https://api.github.com/users/slaskawi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/slaskawi/subscriptions","organizations_url":"https://api.github.com/users/slaskawi/orgs","repos_url":"https://api.github.com/users/slaskawi/repos","events_url":"https://api.github.com/users/slaskawi/events{/privacy}","received_events_url":"https://api.github.com/users/slaskawi/received_events","type":"User","site_admin":false},"body":"Umbrella JIRA: https://issues.jboss.org/browse/ISPN-6635\r\nDesign: https://github.com/infinispan/infinispan/wiki/Multi-tenancy-for-Hotrod-Server\r\n\r\nImplemented subtasks:\r\n* [HotRod](https://issues.jboss.org/browse/ISPN-6636)\r\n* [REST](https://issues.jboss.org/browse/ISPN-6637)\r\n\r\nHighlights:\r\n* Hot Rod implementation uses SNI for routing\r\n* REST uses URL Prefixes\r\n* A full end to end integration tests has been implemented in server test suite\r\n* The documentation has been written in server guide\r\n* Since this PR is gigantic, I marked some interesting places for review\r\n\r\n[Local JMH performance results](https://gist.github.com/slaskawi/51f76b0658b9ee0c9351bd17224b1ba2):\r\n* Initializing connection (SSL/TLS+SNI) is ~`1 ms` slower than pure Hotrod SSL/TLS on my laptop with loopback\r\n* With 10k puts we are `200 ms` slower with multi tenant router (probably it will be better with fine tuning options, epoll etc.)\r\n```\r\nBenchmark                                                                                                     (configurationClassName)  Mode  Cnt     Score    Error  Units\r\nRouterPerf.BenchmarkState.initConnectionAndPerform10KPuts     org.infinispan.server.router.performance.configuration.SingleServerNoSsl  avgt   31   435.645 ± 41.073  ms/op\r\nRouterPerf.BenchmarkState.initConnectionAndPerform10KPuts   org.infinispan.server.router.performance.configuration.SingleServerWithSsl  avgt   31   846.246 ± 21.594  ms/op\r\nRouterPerf.BenchmarkState.initConnectionAndPerform10KPuts  org.infinispan.server.router.performance.configuration.TwoServersWithSslSni  avgt   31  1000.370 ± 22.342  ms/op\r\nRouterPerf.BenchmarkState.initConnectionAndPerform10Puts      org.infinispan.server.router.performance.configuration.SingleServerNoSsl  avgt   31     3.197 ±  0.112  ms/op\r\nRouterPerf.BenchmarkState.initConnectionAndPerform10Puts    org.infinispan.server.router.performance.configuration.SingleServerWithSsl  avgt   31    13.974 ±  0.512  ms/op\r\nRouterPerf.BenchmarkState.initConnectionAndPerform10Puts   org.infinispan.server.router.performance.configuration.TwoServersWithSslSni  avgt   31    14.871 ±  0.552  ms/op\r\nRouterPerf.BenchmarkState.initConnectionOnly                  org.infinispan.server.router.performance.configuration.SingleServerNoSsl  avgt   31     3.046 ±  0.096  ms/op\r\nRouterPerf.BenchmarkState.initConnectionOnly                org.infinispan.server.router.performance.configuration.SingleServerWithSsl  avgt   31    12.725 ±  0.379  ms/op\r\nRouterPerf.BenchmarkState.initConnectionOnly               org.infinispan.server.router.performance.configuration.TwoServersWithSslSni  avgt   31    13.471 ±  0.449  ms/op\r\nRouterPerf.BenchmarkState.perform10KPuts                      org.infinispan.server.router.performance.configuration.SingleServerNoSsl  avgt   31   430.075 ± 18.088  ms/op\r\nRouterPerf.BenchmarkState.perform10KPuts                    org.infinispan.server.router.performance.configuration.SingleServerWithSsl  avgt   31   847.909 ± 34.479  ms/op\r\nRouterPerf.BenchmarkState.perform10KPuts                   org.infinispan.server.router.performance.configuration.TwoServersWithSslSni  avgt   31  1022.655 ± 32.316  ms/op\r\n```","created_at":"2016-05-16T12:52:03Z","updated_at":"2016-07-20T10:04:35Z","closed_at":null,"merged_at":null,"merge_commit_sha":"129645d70e1dc1063719eb4aea72f92ac2b42dd4","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/infinispan/infinispan/pulls/4348/commits","review_comments_url":"https://api.github.com/repos/infinispan/infinispan/pulls/4348/comments","review_comment_url":"https://api.github.com/repos/infinispan/infinispan/pulls/comments{/number}","comments_url":"https://api.github.com/repos/infinispan/infinispan/issues/4348/comments","statuses_url":"https://api.github.com/repos/infinispan/infinispan/statuses/590123ff4bf1fdec0274ae4191bedf35ba6d5907","head":{"label":"slaskawi:ISPN-6635-Multi-tenancy","ref":"ISPN-6635-Multi-tenancy","sha":"590123ff4bf1fdec0274ae4191bedf35ba6d5907","user":{"login":"slaskawi","id":8417158,"avatar_url":"https://avatars.githubusercontent.com/u/8417158?v=3","gravatar_id":"","url":"https://api.github.com/users/slaskawi","html_url":"https://github.com/slaskawi","followers_url":"https://api.github.com/users/slaskawi/followers","following_url":"https://api.github.com/users/slaskawi/following{/other_user}","gists_url":"https://api.github.com/users/slaskawi/gists{/gist_id}","starred_url":"https://api.github.com/users/slaskawi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/slaskawi/subscriptions","organizations_url":"https://api.github.com/users/slaskawi/orgs","repos_url":"https://api.github.com/users/slaskawi/repos","events_url":"https://api.github.com/users/slaskawi/events{/privacy}","received_events_url":"https://api.github.com/users/slaskawi/received_events","type":"User","site_admin":false},"repo":{"id":23697744,"name":"infinispan","full_name":"slaskawi/infinispan","owner":{"login":"slaskawi","id":8417158,"avatar_url":"https://avatars.githubusercontent.com/u/8417158?v=3","gravatar_id":"","url":"https://api.github.com/users/slaskawi","html_url":"https://github.com/slaskawi","followers_url":"https://api.github.com/users/slaskawi/followers","following_url":"https://api.github.com/users/slaskawi/following{/other_user}","gists_url":"https://api.github.com/users/slaskawi/gists{/gist_id}","starred_url":"https://api.github.com/users/slaskawi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/slaskawi/subscriptions","organizations_url":"https://api.github.com/users/slaskawi/orgs","repos_url":"https://api.github.com/users/slaskawi/repos","events_url":"https://api.github.com/users/slaskawi/events{/privacy}","received_events_url":"https://api.github.com/users/slaskawi/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/slaskawi/infinispan","description":"Infinispan is an open source data grid platform and highly scalable NoSQL cloud data store.","fork":true,"url":"https://api.github.com/repos/slaskawi/infinispan","forks_url":"https://api.github.com/repos/slaskawi/infinispan/forks","keys_url":"https://api.github.com/repos/slaskawi/infinispan/keys{/key_id}","collaborators_url":"https://api.github.com/repos/slaskawi/infinispan/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/slaskawi/infinispan/teams","hooks_url":"https://api.github.com/repos/slaskawi/infinispan/hooks","issue_events_url":"https://api.github.com/repos/slaskawi/infinispan/issues/events{/number}","events_url":"https://api.github.com/repos/slaskawi/infinispan/events","assignees_url":"https://api.github.com/repos/slaskawi/infinispan/assignees{/user}","branches_url":"https://api.github.com/repos/slaskawi/infinispan/branches{/branch}","tags_url":"https://api.github.com/repos/slaskawi/infinispan/tags","blobs_url":"https://api.github.com/repos/slaskawi/infinispan/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/slaskawi/infinispan/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/slaskawi/infinispan/git/refs{/sha}","trees_url":"https://api.github.com/repos/slaskawi/infinispan/git/trees{/sha}","statuses_url":"https://api.github.com/repos/slaskawi/infinispan/statuses/{sha}","languages_url":"https://api.github.com/repos/slaskawi/infinispan/languages","stargazers_url":"https://api.github.com/repos/slaskawi/infinispan/stargazers","contributors_url":"https://api.github.com/repos/slaskawi/infinispan/contributors","subscribers_url":"https://api.github.com/repos/slaskawi/infinispan/subscribers","subscription_url":"https://api.github.com/repos/slaskawi/infinispan/subscription","commits_url":"https://api.github.com/repos/slaskawi/infinispan/commits{/sha}","git_commits_url":"https://api.github.com/repos/slaskawi/infinispan/git/commits{/sha}","comments_url":"https://api.github.com/repos/slaskawi/infinispan/comments{/number}","issue_comment_url":"https://api.github.com/repos/slaskawi/infinispan/issues/comments{/number}","contents_url":"https://api.github.com/repos/slaskawi/infinispan/contents/{+path}","compare_url":"https://api.github.com/repos/slaskawi/infinispan/compare/{base}...{head}","merges_url":"https://api.github.com/repos/slaskawi/infinispan/merges","archive_url":"https://api.github.com/repos/slaskawi/infinispan/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/slaskawi/infinispan/downloads","issues_url":"https://api.github.com/repos/slaskawi/infinispan/issues{/number}","pulls_url":"https://api.github.com/repos/slaskawi/infinispan/pulls{/number}","milestones_url":"https://api.github.com/repos/slaskawi/infinispan/milestones{/number}","notifications_url":"https://api.github.com/repos/slaskawi/infinispan/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/slaskawi/infinispan/labels{/name}","releases_url":"https://api.github.com/repos/slaskawi/infinispan/releases{/id}","deployments_url":"https://api.github.com/repos/slaskawi/infinispan/deployments","created_at":"2014-09-05T09:35:13Z","updated_at":"2015-01-22T12:12:41Z","pushed_at":"2016-07-20T03:41:44Z","git_url":"git://github.com/slaskawi/infinispan.git","ssh_url":"git@github.com:slaskawi/infinispan.git","clone_url":"https://github.com/slaskawi/infinispan.git","svn_url":"https://github.com/slaskawi/infinispan","homepage":"http://www.infinispan.org","size":85172,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"infinispan:master","ref":"master","sha":"0447856e56f73cffc4e7771232a767a36c715a3e","user":{"login":"infinispan","id":458093,"avatar_url":"https://avatars.githubusercontent.com/u/458093?v=3","gravatar_id":"","url":"https://api.github.com/users/infinispan","html_url":"https://github.com/infinispan","followers_url":"https://api.github.com/users/infinispan/followers","following_url":"https://api.github.com/users/infinispan/following{/other_user}","gists_url":"https://api.github.com/users/infinispan/gists{/gist_id}","starred_url":"https://api.github.com/users/infinispan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/infinispan/subscriptions","organizations_url":"https://api.github.com/users/infinispan/orgs","repos_url":"https://api.github.com/users/infinispan/repos","events_url":"https://api.github.com/users/infinispan/events{/privacy}","received_events_url":"https://api.github.com/users/infinispan/received_events","type":"Organization","site_admin":false},"repo":{"id":1050944,"name":"infinispan","full_name":"infinispan/infinispan","owner":{"login":"infinispan","id":458093,"avatar_url":"https://avatars.githubusercontent.com/u/458093?v=3","gravatar_id":"","url":"https://api.github.com/users/infinispan","html_url":"https://github.com/infinispan","followers_url":"https://api.github.com/users/infinispan/followers","following_url":"https://api.github.com/users/infinispan/following{/other_user}","gists_url":"https://api.github.com/users/infinispan/gists{/gist_id}","starred_url":"https://api.github.com/users/infinispan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/infinispan/subscriptions","organizations_url":"https://api.github.com/users/infinispan/orgs","repos_url":"https://api.github.com/users/infinispan/repos","events_url":"https://api.github.com/users/infinispan/events{/privacy}","received_events_url":"https://api.github.com/users/infinispan/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/infinispan/infinispan","description":"Infinispan is an open source data grid platform and highly scalable NoSQL cloud data store.","fork":false,"url":"https://api.github.com/repos/infinispan/infinispan","forks_url":"https://api.github.com/repos/infinispan/infinispan/forks","keys_url":"https://api.github.com/repos/infinispan/infinispan/keys{/key_id}","collaborators_url":"https://api.github.com/repos/infinispan/infinispan/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/infinispan/infinispan/teams","hooks_url":"https://api.github.com/repos/infinispan/infinispan/hooks","issue_events_url":"https://api.github.com/repos/infinispan/infinispan/issues/events{/number}","events_url":"https://api.github.com/repos/infinispan/infinispan/events","assignees_url":"https://api.github.com/repos/infinispan/infinispan/assignees{/user}","branches_url":"https://api.github.com/repos/infinispan/infinispan/branches{/branch}","tags_url":"https://api.github.com/repos/infinispan/infinispan/tags","blobs_url":"https://api.github.com/repos/infinispan/infinispan/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/infinispan/infinispan/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/infinispan/infinispan/git/refs{/sha}","trees_url":"https://api.github.com/repos/infinispan/infinispan/git/trees{/sha}","statuses_url":"https://api.github.com/repos/infinispan/infinispan/statuses/{sha}","languages_url":"https://api.github.com/repos/infinispan/infinispan/languages","stargazers_url":"https://api.github.com/repos/infinispan/infinispan/stargazers","contributors_url":"https://api.github.com/repos/infinispan/infinispan/contributors","subscribers_url":"https://api.github.com/repos/infinispan/infinispan/subscribers","subscription_url":"https://api.github.com/repos/infinispan/infinispan/subscription","commits_url":"https://api.github.com/repos/infinispan/infinispan/commits{/sha}","git_commits_url":"https://api.github.com/repos/infinispan/infinispan/git/commits{/sha}","comments_url":"https://api.github.com/repos/infinispan/infinispan/comments{/number}","issue_comment_url":"https://api.github.com/repos/infinispan/infinispan/issues/comments{/number}","contents_url":"https://api.github.com/repos/infinispan/infinispan/contents/{+path}","compare_url":"https://api.github.com/repos/infinispan/infinispan/compare/{base}...{head}","merges_url":"https://api.github.com/repos/infinispan/infinispan/merges","archive_url":"https://api.github.com/repos/infinispan/infinispan/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/infinispan/infinispan/downloads","issues_url":"https://api.github.com/repos/infinispan/infinispan/issues{/number}","pulls_url":"https://api.github.com/repos/infinispan/infinispan/pulls{/number}","milestones_url":"https://api.github.com/repos/infinispan/infinispan/milestones{/number}","notifications_url":"https://api.github.com/repos/infinispan/infinispan/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/infinispan/infinispan/labels{/name}","releases_url":"https://api.github.com/repos/infinispan/infinispan/releases{/id}","deployments_url":"https://api.github.com/repos/infinispan/infinispan/deployments","created_at":"2010-11-04T12:33:19Z","updated_at":"2016-07-18T10:10:38Z","pushed_at":"2016-07-20T03:41:46Z","git_url":"git://github.com/infinispan/infinispan.git","ssh_url":"git@github.com:infinispan/infinispan.git","clone_url":"https://github.com/infinispan/infinispan.git","svn_url":"https://github.com/infinispan/infinispan","homepage":"http://www.infinispan.org","size":101017,"stargazers_count":487,"watchers_count":487,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":360,"mirror_url":null,"open_issues_count":24,"forks":360,"open_issues":24,"watchers":487,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/infinispan/infinispan/pulls/4348"},"html":{"href":"https://github.com/infinispan/infinispan/pull/4348"},"issue":{"href":"https://api.github.com/repos/infinispan/infinispan/issues/4348"},"comments":{"href":"https://api.github.com/repos/infinispan/infinispan/issues/4348/comments"},"review_comments":{"href":"https://api.github.com/repos/infinispan/infinispan/pulls/4348/comments"},"review_comment":{"href":"https://api.github.com/repos/infinispan/infinispan/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/infinispan/infinispan/pulls/4348/commits"},"statuses":{"href":"https://api.github.com/repos/infinispan/infinispan/statuses/590123ff4bf1fdec0274ae4191bedf35ba6d5907"}}}}
{"actor":{"display_login":"slaskawi"}}