Serializable Session Factory

Description

Deeply serializable session factory. Enabled with System Property hibernate.deepserialization=true. By default serialization behaves as today where it just serializes name/uuid and looks up the session factory upon deserialization. Tested with
spatial, ehcache, infinispan, h2, postgres.

Activity

Show:

Christian Beikov April 5, 2024 at 11:54 AM

Quarkus is the way to improve startup performance. Serialization will not help. Maybe at some point the CRaC project, when it lands in the JDK will help.

Sanne Grinovero June 8, 2020 at 1:05 PM

Related discussion:

I’d love to know how far bootstrap is still a problem after all optimisations which we’ve done in Hibernate 5.4.x - specifically to improve bootstrap?

Also please checkout Quarkus, as we worked closely together to improve bootstrap times - we’re not using Java Serialization but I believe it’s a better approach, as it allows bootstrap in the order of milliseconds when compiled to native image, and it does great in not-native as well.

I’m skeptical that an approach based on serialization would be able to outperform the Quarkus boostrap code - not to mention that it would have some problems, such as needing to verify if the serialized state is matching the current application state.

Gautam January 3, 2019 at 4:46 AM

One particular usecase where this feature could be handy -

We anticipate thousands of small schemas in a specific deployment of our platform which means thousands if not hundreds of thousands of session factories. We have a clustered environment of mysql + jetty and would like to avoid building the sessionfactory more than once.

So for us it would be handy -

1. Build SessionFactory of a schema on first demand
2. Serialize and place a copy of inactive ones on a distributed cache or local.
3. Load it back when needed.
4. Keep the most active schema session factories in in-memory cache.
5. Connection pool and other resources will obviously remain local.

Rejected

Details

Assignee

Reporter

Components

Priority

Created June 13, 2016 at 6:53 AM
Updated April 5, 2024 at 11:54 AM
Resolved April 5, 2024 at 11:54 AM