QFoundation - Entity layer for Java

Let me introduce my Java entity layer to the community.

Screenshots, documentation, getting started guide, maven coordinates and source code are available at the project website licensed under the Apache License.

The entity layer provides a JPA-like access pattern for your POJO entities, where you have the choice to use mutable or immutable entities. It has a persistence context, so every mutation is automatically applied at commit/flush time. The layer is packaged as a Quarkus extension (with a bunch of build time AOT automatic configuration) and supports native compilation, so you can use it in serverless deployments and regular JVM applications also. The extension consists of multiple layers, most are turned off by default and removed in the build phase if not used.

Entity layer features:

  • Use regular @jakarta.transaction.Transactional annotations for an automatic FDB transaction
  • The JTA-managed FDB transaction is propagated to forked virtual threads, so you can use Structured Concurrency and do things in parallel inside a single transaction while still using a nice blocking style of programming, no async programming needed.
  • Inject a com.apple.foundationdb.Transaction for low level access
  • Inject a Persistence object for entity access
  • Automatic entity registration at build time
  • Retrieval: find (single key get), lazy stream, load (snapshot isolation and transaction splitting)
  • Find by exact id, or restrictions on the id
  • Find by partial id in case of id is a POJO, make restrictions on the fields of the id
  • Find by indexed fields, or restrictions on them. Indexes are POJOs and queries are strongly typed.
  • getReference for lazy entity proxies
  • Covering index queries (retrieve index POJOs)
  • Normal or materialized indices (index size vs n+1 problem)
  • Partial indices based on expressions
  • Kryo/Smile/Json serialization of entities
  • Optional entity compression using LZ4
  • Full and automatic GraalVM support

Other layers are built on top of the entity layer and include a distributed micro-matching enabled DAG job processing layer, a distributed, persistent actor layer, a message queue/topic layer and a simple proof-of-concept implementation of Apple’s QuiCK paper. The distributed layers use entities and FDB watches to communicate, coordinate and load balance.

There is an web based admin interface to query/manage the different layers and FoundationDB (UI for entity queries, entity and index level statistics, etc.)

3 Likes

Great job!

But who maintains this layer?
It only has one commit. It looks like some internal solution was published.

Thank you. This is my personal research project, so I’m the sole maintainer. It got to a point where the main features were stable for months so I published it with an initial commit.

I’ll keep it updated to the latest versions of Quarkus LTS releases (coming this September) and fix bugs if found. Bits and pieces of it were/are used in production, it could really accelerate development.

Considered stable, were in production:

  • Entity layer
  • Distributed primitives (locks, partition allocation, watch processors, etc.)
  • Operations layer (job graph, micro batching)
  • Time series layer

Were not used in production:

  • Messaging layer (queues and topics)
  • Actor layer
  • QuiCK work queues