<div dir="ltr">Actually looking into this closer.  I have found a way to completely remove the expiration interceptor with minimal drawback.  The drawback is that a remove expired command will be generated if a read finds the entry gone is concurrently fired with a write for the same key. But I would say this should happen so infrequently that it probably shouldn&#39;t matter.<div><br></div><div>I have put it all on [1] and all the tests seem to pass fine.  I want to double check a few things but this should be pretty good.</div><div><br></div><div>[1] <a href="https://github.com/wburns/infinispan/commits/expiration_listener">https://github.com/wburns/infinispan/commits/expiration_listener</a><br><div><div><br><div class="gmail_quote"><div dir="ltr">On Mon, Nov 30, 2015 at 5:46 PM Sanne Grinovero &lt;<a href="mailto:sanne@infinispan.org" target="_blank">sanne@infinispan.org</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Wouldn&#39;t it be an interesting compromise to make sure we calculate<br>
things like the key&#39;s hash only once?<br>
<br>
On 30 November 2015 at 21:54, William Burns &lt;<a href="mailto:mudokonman@gmail.com" target="_blank">mudokonman@gmail.com</a>&gt; wrote:<br>
&gt; I am not sure there is an easy way to consolidate these into a single map,<br>
&gt; since some of these are written to on reads, some on writes and sometimes<br>
&gt; conditionally written to.  And then as Dan said they are cleaned up at<br>
&gt; different times possibly.<br>
&gt;<br>
&gt; We could do something like states (based on which ones would have written to<br>
&gt; the map), but I think it will get quite complex, especially if we ever add<br>
&gt; more of these map type requirement.<br>
&gt;<br>
&gt; On a similar note, I had actually thought of possibly moving the expiration<br>
&gt; check out of the data container and into the entry wrapping interceptor or<br>
&gt; the likes.  This would allow for us to remove the expiration map completely<br>
&gt; since we could only raise the extra expiration commands on a read and not<br>
&gt; writes.  But this would change the API and I am thinking we can only do this<br>
&gt; for 9.0.<br>
&gt;<br>
&gt; On Mon, Nov 30, 2015 at 2:18 PM Dan Berindei &lt;<a href="mailto:dan.berindei@gmail.com" target="_blank">dan.berindei@gmail.com</a>&gt; wrote:<br>
&gt;&gt;<br>
&gt;&gt; The first problem that comes to mind is that context entries are also<br>
&gt;&gt; stored in a map, at least in transactional mode. So access through the<br>
&gt;&gt; context would only be faster in non-tx caches, in tx caches it would<br>
&gt;&gt; not add any benefits.<br>
&gt;&gt;<br>
&gt;&gt; I also have some trouble imagining how these temporary entries would<br>
&gt;&gt; be released, since locks, L1 requestors, L1 synchronizers, and write<br>
&gt;&gt; registrations all have their own rules for cleaning up.<br>
&gt;&gt;<br>
&gt;&gt; Finally, I&#39;m not sure how much this would help. I actually removed the<br>
&gt;&gt; write registration for everything except RemoveExpiredCommand when<br>
&gt;&gt; testing the HotRod server performance, but I didn&#39;t get any<br>
&gt;&gt; significant improvement on my machine. Which was kind of expected,<br>
&gt;&gt; since the benchmark doesn&#39;t seem to be CPU-bound, and JFR was showing<br>
&gt;&gt; it with &lt; 1.5% of CPU.<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; Cheers<br>
&gt;&gt; Dan<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; On Fri, Nov 27, 2015 at 11:28 AM, Radim Vansa &lt;<a href="mailto:rvansa@redhat.com" target="_blank">rvansa@redhat.com</a>&gt; wrote:<br>
&gt;&gt; &gt; No thoughts at all? @wburns, could I have your view on this?<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; Thanks<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; Radim<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; On 11/23/2015 04:26 PM, Radim Vansa wrote:<br>
&gt;&gt; &gt;&gt; Hi again,<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; examining some flamegraphs I&#39;ve found out that recently the<br>
&gt;&gt; &gt;&gt; ExpirationInterceptor has been added, which registers ongoing write in<br>
&gt;&gt; &gt;&gt; a<br>
&gt;&gt; &gt;&gt; hashmap. So at this point we have a map for locks, map for writes used<br>
&gt;&gt; &gt;&gt; for expiration, another two key-addressed maps in L1ManagerImpl and one<br>
&gt;&gt; &gt;&gt; in L1NonTxInterceptor and maybe another maps elsewhere.<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; This makes me think that we could spare map lookups and expensive<br>
&gt;&gt; &gt;&gt; writes<br>
&gt;&gt; &gt;&gt; by providing *single map for temporary per-key data*. A reference to<br>
&gt;&gt; &gt;&gt; the<br>
&gt;&gt; &gt;&gt; entry could be stored in the context to save the lookups. An extreme<br>
&gt;&gt; &gt;&gt; case would be to put this into DataContainer, but I think that this<br>
&gt;&gt; &gt;&gt; would prove too tricky in practice.<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; A downside would be the loss of encapsulation (any component could<br>
&gt;&gt; &gt;&gt; theoretically access e.g. locks), but I don&#39;t find that too dramatic.<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; WDYT?<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; Radim<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; --<br>
&gt;&gt; &gt; Radim Vansa &lt;<a href="mailto:rvansa@redhat.com" target="_blank">rvansa@redhat.com</a>&gt;<br>
&gt;&gt; &gt; JBoss Performance Team<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; _______________________________________________<br>
&gt;&gt; &gt; infinispan-dev mailing list<br>
&gt;&gt; &gt; <a href="mailto:infinispan-dev@lists.jboss.org" target="_blank">infinispan-dev@lists.jboss.org</a><br>
&gt;&gt; &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>
&gt;&gt; _______________________________________________<br>
&gt;&gt; infinispan-dev mailing list<br>
&gt;&gt; <a href="mailto:infinispan-dev@lists.jboss.org" target="_blank">infinispan-dev@lists.jboss.org</a><br>
&gt;&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>
&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>
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><br>
</blockquote></div></div></div></div></div>