<div dir="ltr"><div class="gmail_quote"><div dir="ltr">On Tue, Dec 11, 2018 at 11:13 AM Radim Vansa &lt;<a href="mailto:rvansa@redhat.com" target="_blank">rvansa@redhat.com</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I dislike having any logic based on the port number in some range; it&#39;s <br>
not common that behaviour would change if you set port to 9xxx instead <br>
of 8xxx.<br></blockquote><div><br></div></div><div dir="ltr"><div class="gmail_quote"><div>That&#39;s not a problem with my approach, since you can always manually turn the setting off or on. Here&#39;s how you do it:</div><div>ConfigurationBuilder cb = ...</div><div>cb.singlePort(SinglePortMode.ENABLED); // other options: DISABLED and AUTO</div></div></div><div dir="ltr"><div class="gmail_quote"><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Is there an (up-to-date) design doc?<br></blockquote><div><br></div></div></div><div dir="ltr"><div class="gmail_quote"><div>No, this is just a proposal. I was hoping that you guys like it and then, with some thumbs up, I could update the design doc. </div><div><br></div><div>Here&#39;s the most up-to-date version in case you were looking for it: <a href="https://github.com/infinispan/infinispan-designs/blob/master/Single_port.adoc" target="_blank">https://github.com/infinispan/infinispan-designs/blob/master/Single_port.adoc</a></div></div></div><div dir="ltr"><div class="gmail_quote"><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
I don&#39;t fully follow, but if there&#39;s a problem in the HTTP handlers you <br>
can add a PING-detecting handler below...?<br></blockquote><div><br></div></div></div><div dir="ltr"><div class="gmail_quote">Thanks for the hint Radim!</div><div class="gmail_quote"><br></div><div class="gmail_quote">Inspired by your idea I went ahead and checked how OpenShift Router behaves. It turns out that it responds HTTP 400 if you throw Hotrod bytes at it and then drops the connection. I also realized, there&#39;s one more moving bit - TCP Keepalive. Luckily, we can control this setting over configuration in our standalone.xml. However, it is perfectly legal what I&#39;ve seen in Netty (do not respond and keep the connection alive assuming that TCP Keepalive is set to true).</div><div class="gmail_quote"><br></div><div class="gmail_quote">The more I think about this, the more I&#39;m convinced that the Single Port support should be explicitly set in the client (or inferred from the configuration). I do not know how Nginx, Linkerd or Envoy behaves in situation when they expect HTTP and get a stream of bytes. Relying on this partially unknown behavior for doing our upgrade procedure doesn&#39;t seem right to me. </div><div class="gmail_quote"><br></div><div class="gmail_quote">Just in case you&#39;re worried about the additional logic on the client side - it&#39;s super small. Really, only 13 lines including brackets ;) <a href="https://github.com/infinispan/infinispan/pull/6133/files#diff-684a10c939f31fcfef0f5f48d469393aR618">https://github.com/infinispan/infinispan/pull/6133/files#diff-684a10c939f31fcfef0f5f48d469393aR618</a></div></div><div dir="ltr"><div class="gmail_quote"><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Radim<br>
<br>
On 12/10/2018 03:27 PM, Sebastian Laskawiec wrote:<br>
&gt; Hey guys,<br>
&gt;<br>
&gt; During Infinispan F2F, I had a short discussion with Tristan on Single <br>
&gt; Port client-side implementation. Back then, we agreed that the client <br>
&gt; should always send a Hotrod Ping request and if won&#39;t get any response <br>
&gt; (or get some HTTP content back), it will try to upgrade to the Hotrod <br>
&gt; protocol using Single Port.<br>
&gt;<br>
&gt; I&#39;ve been playing with the implementation for a while, and <br>
&gt; implementing it this way seems a bit &quot;inconvenient&quot; to me. The Ping <br>
&gt; Operation uses 60s timeout, which seems to be a good fit as a default. <br>
&gt; Unfortunately, for the Single Port functionality, this means we&#39;d need <br>
&gt; to wait 60s until we try to send HTTP request and do an upgrade. Also, <br>
&gt; another problematic part is in Netty&#39;s HTTP handlers <br>
&gt; (HttpObjectDecoder, HttpServerCodec and ByteToMessageDecoder). When <br>
&gt; those classes fail to decode a message (REST expects HTTP rather than <br>
&gt; a stream of bytes specific to Hotrod protocol), they just ignore it <br>
&gt; and keep the channel in active state (which also makes sense for <br>
&gt; HTTP/1.1 and HTTP/2).<br>
&gt;<br>
&gt; At this point, my intuition tells, that this doesn&#39;t look right and <br>
&gt; seems to be a over-complicated. The whole HTTP upgrade idea seems to <br>
&gt; work the other way around, use HTTP as a fallback and then upgrade to <br>
&gt; other protocols. Forcing it to work a bit differently requires some <br>
&gt; more effort.<br>
&gt;<br>
&gt; What if we preserved the Single Port setting in the client <br>
&gt; configuration but implemented it as an enum with the following values <br>
&gt; - true/false/auto. In automatic mode, the client would check if the <br>
&gt; server port is set to 8\d{1,3} (this covers 80, 8080, 8081, 8443 and <br>
&gt; friends). If that is true, we&#39;d try to follow HTTP Upgrade procedure. <br>
&gt; This looks very simple and I think this might actually work. Please <br>
&gt; note, that we need the single port setting in the client configuration <br>
&gt; to cover some corner cases like the Single Port exposed on different <br>
&gt; port (like 4444) or Hot Rod exposed on port that starts with 8.<br>
&gt;<br>
&gt; What do you think about such simplification?<br>
&gt;<br>
&gt; Thanks,<br>
&gt; Sebastian<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; _______________________________________________<br>
&gt; infinispan-dev mailing list<br>
&gt; <a href="mailto:infinispan-dev@lists.jboss.org" target="_blank">infinispan-dev@lists.jboss.org</a><br>
&gt; <a href="https://lists.jboss.org/mailman/listinfo/infinispan-dev" rel="noreferrer" target="_blank">https://lists.jboss.org/mailman/listinfo/infinispan-dev</a><br>
<br>
<br>
-- <br>
Radim Vansa &lt;<a href="mailto:rvansa@redhat.com" target="_blank">rvansa@redhat.com</a>&gt;<br>
JBoss Performance Team<br>
<br>
_______________________________________________<br>
infinispan-dev mailing list<br>
<a href="mailto:infinispan-dev@lists.jboss.org" target="_blank">infinispan-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/infinispan-dev" rel="noreferrer" target="_blank">https://lists.jboss.org/mailman/listinfo/infinispan-dev</a></blockquote></div></div></div>