Jump to: navigation, search


Design Specification: Performance and Concurrency

ER 398411


Document History

Date Author Version Description & Notes
2013-01-17 James 0.1 Draft

Project overview

This project groups several smaller performance related bug fixes and enhancements into a single unit. Its' goal is the improve the performance, concurrency and scalability of the product.


Performance is concerned about reducing CPU usage and finding more optimal methods of processing operations.

Concurrency is concerned with reducing contention and improving multi-threaded and multi-CPU performance.

Scalability is concerned with clustering, large workloads and data.


The goal of this project is to ensure that our product remains the leading high-performance persistence solution. Areas of improvement are determined through performance comparison with other persistence products and benchmarking.

Design Constraints

The goal of the project is to improve performance of common usage patterns. Fringe features and usage patterns will not be specifically targeted unless found to be highly deficient.

Any optimization must also be weighed in its' impact on usability, and spec compliance. Optimizations that may have a large negative impact to usability may need to be only enabled through specific configuration.


Each specific performance improvement is discussed separately below.

Query Results Cache Invalidation

Query results caching is currently supported on any named query. The query results are never invalidated when changes occur, so the cache can become out of synch with the database. Note, the object is the query results are kept up to date, but if changes to the objects, or new/deleted objects affect the query results, this is not reflected. The query results cache does support timeToLive and daily invalidation.

A option will be added to invalidate the query results cache, this will be enabled by default. Any change (insert/update/delete) to any of the classes that the query returns will cause the query results for that query to be invalidated (cleared). Changes to classes not used in the query (joins are considered used) will not affect the query results.

This is coarse grained invalidation, any insert, update or delete will cause all of the queries for that class to be invalidated, even if the query was not affected by that modification. Fine grained invalidation would be prohibitively expensive, as you would need to re-run the query in-memory on the object, but may be considered as a future enhancement.

A option will be provided to enable query results cache on all named queries.

Concurrent Processing

Concurrent processing could be used in many areas to improve performance.

An option will be provided on the Session to process query results concurrently. This will cause the rows to be fetched on a separate thread, allowing the objects to be built concurrently to the row fetching. This can improve the performance of large queries.

An option will be provided on a LoadGroup to load the relationships concurrently. This will use a separate thread for each relationship, allowing the related objects to be fetched and built concurrently to building the parent object and other relationships.

WeakIdentityMap cache key cleanup will occur on a separate thread for concurrent sessions. This avoids blocks the main thread and allows the cleanup to occur in the background.

A fixed size thread pool (default 32 threads) will be used for concurrent processing. The thread pool will be defined on the ServerPlatform, and a platform may choose to use the server's thread pool (none currently do). The thread pool will be configurable through persistence unit properties.

A persistence unit property should be provided to enable concurrency.

Concurrent processing will only affect response time, not throughput, as it only make better use of idle CPU. On a fully loaded system, it could decrease throughput as additional locking overhead is required.


Both the existing performance and concurrency tests and pubic benchmarks will be used to monitor and evaluate performance improvements.


Config files


Open Issues

Issue # Owner Description / Notes


Issue # Description / Notes Decision

Future Considerations

Continually improve performance.