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

Optimize metadata mapping in distributed session managers

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Done
    • Icon: Major Major
    • 30.0.0.Final
    • 29.0.0.Final
    • Clustering
    • None

      The metadata for a single HttpSession is mapped to 2 cache entries: 1 entry stores immutable meta data (e.g. creation time) as well as meta data this is not typically changed following creation (e.g. maxInactiveInterval); and 1 entry stores meta data that changes every request (e.g. duration since creation).
      The intention was to minimize the the payload for requests for existing sessions, where only the duration since creation requires updating.

      There are a few problems with this approach:
      1. Each cache entry requires the overhead of the cache key
      2. The existing mapping is prone to cross-entry data integrity issues, which can affect non-transactional use cases

      By leveraging Cache.compute(...), we can, encapsulate any meta data changes within a function, allowing us to store all meta data in a single cache entry, while still minimizing the payload per request. Additionally, since the compute function has access to the existing
      maxInactiveInterval and duration since creation, we don't need to send full duration value, but only the differences. Thus the payload of this value will never increase over time, as it does currently, since ProtoStream requires fewer bytes for smaller numeric values.

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

              Created:
              Updated:
              Resolved: