<div dir="ltr">On Fri, Aug 19, 2016 at 3:39 PM, Dan Berindei <span dir="ltr">&lt;<a href="mailto:dan.berindei@gmail.com" target="_blank">dan.berindei@gmail.com</a>&gt;</span> wrote:<br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">I just had a discussion with Adrian, and he reminded me that the key<br>
partitioners don&#39;t yet work with any HotRod client.<br>
<br>
Assuming we&#39;ll have for HotRod key partitioners soon,<br>
AffinityPartitioner still won&#39;t work with remote caches, where we want<br>
to keep the key as a byte[]. Instead, we would need a key partitioner<br>
that knows protobuf and can parse a single field from the object.<br>
<br>
So I&#39;d like to withdraw my support for making AffinityPartitioner the default :)<br>
<br></blockquote><div><br><br></div><div>+1 for me, I don&#39;t think it should be default. Currently the Hot Rod protocol <br></div><div>is hardcoded to use a hash function to map keys to segments (byte field <br>in the header to indicate hash function version to use), so C#, C++, JS <br>clients would not be able to take advantage of the AffinityPartitioner.<br><br></div><div>Another thing to consider is for query usage, mapping 1 segment to 1 <br>index shard uses lots of resources, and I&#39;ve been exploring ways of <br>making this configurable [1], which potentially could require a different <br>partitioner.<br><br></div><div>That does not mean it should never be default, we can revisit this later.<br><br><br></div><div>Gustavo<br></div><div><br><br>[1] <a href="https://issues.jboss.org/browse/ISPN-6225">https://issues.jboss.org/browse/ISPN-6225</a><br></div><div><br> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Cheers<br>
<span class=""><font color="#888888">Dan<br>
</font></span><div class=""><div class="h5"><br>
<br>
On Fri, Aug 19, 2016 at 5:20 PM, Dan Berindei &lt;<a href="mailto:dan.berindei@gmail.com">dan.berindei@gmail.com</a>&gt; wrote:<br>
&gt; On Thu, Aug 18, 2016 at 6:12 PM, Sanne Grinovero &lt;<a href="mailto:sanne@infinispan.org">sanne@infinispan.org</a>&gt; wrote:<br>
&gt;&gt; On 18 August 2016 at 14:44, Dan Berindei &lt;<a href="mailto:dan.berindei@gmail.com">dan.berindei@gmail.com</a>&gt; wrote:<br>
&gt;&gt;&gt; First, a question: doesn&#39;t query already configure its internal caches<br>
&gt;&gt;&gt; to use the AffinityPartitioner? Does it need the application caches to<br>
&gt;&gt;&gt; have AffinityPartitioner enabled, too?<br>
&gt;&gt;<br>
&gt;&gt; No, we may provide reasonable defaults so that demos and tutorials<br>
&gt;&gt; work out of the box but the general recommendation is that people make<br>
&gt;&gt; their own configuration, as they will need to tune things, or add<br>
&gt;&gt; CacheStores, etc..<br>
&gt;&gt;<br>
&gt;<br>
&gt; I see... I wonder if we could at least have some templates for the<br>
&gt; user to extend, without having to copy a bunch of stuff from<br>
&gt; tutorials?<br>
&gt;<br>
&gt;<br>
&gt;&gt;&gt; I&#39;m ok with making AffinityPartitioner the default key partitioner:<br>
&gt;&gt;&gt; the less configuration the user has to change to make things work, the<br>
&gt;&gt;&gt; better. I&#39;m also ok with changing it to use delegation, to make it<br>
&gt;&gt;&gt; easy for user to compose it with another key partitioner. We should<br>
&gt;&gt;&gt; just run some benchmarks first to check it doesn&#39;t affect performance<br>
&gt;&gt;&gt; for repl mode reads.<br>
&gt;&gt;<br>
&gt;&gt; Ok!<br>
&gt;&gt; <a href="https://issues.jboss.org/browse/ISPN-6956" rel="noreferrer" target="_blank">https://issues.jboss.org/<wbr>browse/ISPN-6956</a><br>
&gt;&gt;<br>
&gt;&gt; I&#39;ll send a PR; regarding benchmarking I&#39;ll take the optimistic path:<br>
&gt;&gt; we&#39;ll test it after it&#39;s integrated, worst case we can take it out.<br>
&gt;&gt;<br>
&gt;&gt;&gt; But I feel users should be able to disable it if they want to, so I<br>
&gt;&gt;&gt; wouldn&#39;t always wrap user partitioners. Also, usually less magic ==<br>
&gt;&gt;&gt; better. Query can validate the configuration and warn the user if the<br>
&gt;&gt;&gt; configuration doesn&#39;t have AffinityPartitioner in place.<br>
&gt;&gt;<br>
&gt;&gt; I disagree on this as this would require more options, which make it<br>
&gt;&gt; harder to use, and there&#39;s no good enough reason to give away the<br>
&gt;&gt; option to disable this; especially as it kills other features.<br>
&gt;&gt;<br>
&gt;<br>
&gt; Well, grouping isn&#39;t enabled by default, even though that means<br>
&gt; AdvancedCache.getGroup(String) doesn&#39;t work with the default<br>
&gt; configuration. Sure, AffinityPartitioner&#39;s overhead is probably lower<br>
&gt; than GroupingPartitioner&#39;s for non-targeted keys, but would you want<br>
&gt; to wrap all key partitioners with AffinityPartitioner if we were<br>
&gt; already wrapping them all with GroupingPartitioner?<br>
&gt;<br>
&gt; TBH I don&#39;t know why a user would want to customize the key<br>
&gt; partitioner when he could implement AffinityTaggedKey instead...<br>
&gt;<br>
&gt;<br>
&gt;&gt; BTW I never mentioned Query :)<br>
&gt;<br>
&gt; You did mention your &quot;evil&quot; plans to improve query performance :D<br>
&gt;<br>
&gt;<br>
&gt;&gt; We happen to use this functionality in Query but as I mentioned other<br>
&gt;&gt; teams are looking forward to use this functionality, so I think we<br>
&gt;&gt; should promote this as a public API, a new feature of Infinispan core.<br>
&gt;&gt;<br>
&gt;<br>
&gt; AffinityTaggedKey was already in the public API, even before<br>
&gt; AffinityPartitioner was the default. So now we have these options for<br>
&gt; influencing the key distribution:<br>
&gt; * Implementing AffinityTaggedKey<br>
&gt; * Implementing a custom KeyPartitioner<br>
&gt; * Grouping: annotating a key method with @Group, or implementing Grouper<br>
&gt; * Generating random keys and mapping them to nodes with KeyAffinityService<br>
&gt;<br>
&gt;<br>
&gt;&gt; So since you want to be able to disable it I won&#39;t wrap all user<br>
&gt;&gt; configured implementations in my PR for ISPN-6956, but I&#39;d prefer it<br>
&gt;&gt; if as a second step you would reconsider and allow me to wrap them<br>
&gt;&gt; all.<br>
&gt;&gt;<br>
&gt;<br>
&gt; Feel free to open a separate PR for this, I&#39;m definitely not going to<br>
&gt; block it from going in.<br>
&gt;<br>
&gt; Cheers<br>
&gt; Dan<br>
______________________________<wbr>_________________<br>
infinispan-dev mailing list<br>
<a href="mailto:infinispan-dev@lists.jboss.org">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/<wbr>mailman/listinfo/infinispan-<wbr>dev</a><br>
</div></div></blockquote></div><br></div></div>