1. OpenJPA
  2. OPENJPA-1150

Add WriteBehind mode to cache updates before flushing to backing store


    • Type: New Feature New Feature
    • Status: Closed
    • Priority: Major Major
    • Resolution: Won't Fix
    • Affects Version/s: 2.1.0
    • Fix Version/s: None
    • Component/s: writebehind
    • Labels:


      The current L2 / DataCache implementation is exhibits write-through behavior. When an entity is updated its contents are updated in the datacache and then flushed to the backing store when the transaction completes.

      This feature will enable write-behind behavior - instead of updating the backing store when the transaction completes, the updates will be cached in memory until until triggered to truly flush. This approach has the effect of reducing the load on the backing store and (hopefully) improving overall throughput.

      Naturally there are some caveats to this approach.

      1. A DataCache must be used in conjunction with the WriteBehind cache. The DataCache will be kept in sync with the WriteBehind cache reducing the possibility of stale reads.
      2. When operating in write-behind mode you need to take care that OpenJPA is the only application accessing these rows. Updates from other applications may lead to errors when the write-behind cache is flushed.
      2a. Some care must be taken when running on multiple JVMs. The DataCache & WriteBehindCache need to be kept in sync across JVMs. The DataCache has some capability in this area and the WriteBehindCache will further extend that.
      2b. The application must contain some logic to recover from a failed update.
      3. Database generated columns (ie IDENTITY, SEQUENCE) will not work correctly (at least not with the initial version of write-behind)
      3a. Table generated columns will work, but the SQL used to obtain the value from the table will bypass the WriteBehindCache (ie you may see some database traffic in this case).

      This support may not be suitable for every application. Write heavy applications will see great benefit as will applications which place high load on the database. The feature should not be enabled by default and should be considered strictly optional.


        Transition Time In Source Status Execution Times Last Executer Last Execution Date
        Open Open Closed Closed
        39d 21h 34m 1 Michael Dick 09/Aug/09 17:44
        Closed Closed Reopened Reopened
        165d 21h 30m 1 Michael Dick 22/Jan/10 15:14
        Reopened Reopened Closed Closed
        242d 6h 3m 1 Michael Dick 21/Sep/10 21:17
        Michael Dick made changes -
        Status Reopened [ 4 ] Closed [ 6 ]
        Resolution Won't Fix [ 2 ]
        Michael Dick made changes -
        Assignee Michael Dick [ mikedd ]
        Fix Version/s 2.1.0 [ 12314542 ]
        Michael Dick made changes -
        Affects Version/s 2.1.0 [ 12314542 ]
        Affects Version/s 2.0.0-M2 [ 12313483 ]
        Component/s writebehind [ 12312973 ]
        Component/s kernel [ 12311302 ]
        Michael Dick made changes -
        Fix Version/s 2.1.0 [ 12314542 ]
        Fix Version/s 2.0.0-M3 [ 12314148 ]
        Michael Dick added a comment -

        Tentatively assigning to 2.1.0

        Michael Dick added a comment - Tentatively assigning to 2.1.0
        Michael Dick made changes -
        Resolution Fixed [ 1 ]
        Status Closed [ 6 ] Reopened [ 4 ]
        Michael Dick added a comment -

        Reopening to back out the incomplete WriteBehind implementation

        Michael Dick added a comment - Reopening to back out the incomplete WriteBehind implementation
        Donald Woods made changes -
        Fix Version/s 2.0.0-M3 [ 12314148 ]
        Fix Version/s 2.0.0 [ 12314019 ]
        Affects Version/s 2.0.0-M2 [ 12313483 ]
        Affects Version/s 2.0.0 [ 12314019 ]
        Michael Dick made changes -
        Field Original Value New Value
        Status Open [ 1 ] Closed [ 6 ]
        Resolution Fixed [ 1 ]
        Michael Dick created issue -


          • Assignee:
            Michael Dick
          • Votes:
            0 Vote for this issue
            0 Start watching this issue


            • Created: