Uploaded image for project: 'WildFly'
  1. WildFly
  2. WFLY-20842

TinyLFU is not appropriate for EJB timer use case

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • 39.0.0.Beta1
    • 37.0.0.Final
    • Clustering, EJB
    • None
    • ---
    • ---

      Currently, the Infinispan TimerService implementation exposes a max-active-timers attribute that enables the eviction/passivation of the least frequently used timers when the number of timers exceeds the specified threshold.
      As discussed in WFLY-20839, an optimal eviction policy for the timer use case would chose those timers whose next timeout is furthest in the future (i.e. more likely to have been updated recently), rather than chosing those timers used least frequently (i.e. likely the worst choice).
      Unfortunately, Caffeine does not expose any mechanism to override its TinyLFU algorithm, and has no plans to support this: https://github.com/ben-manes/caffeine/issues/100
      In lieu of this, we should replace the enforcement of this threshold from Infinispan/Caffeine to the timer scheduler itself.
      The timer scheduler maintains an collection of timer IDs ordered by timeout. If this collection grows beyond the configured threshold, we can easily determine the optimal set of entries to evict from the backing Infinispan cache.

              pferraro@redhat.com Paul Ferraro
              pferraro@redhat.com Paul Ferraro
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated: