Speeding up hibernate startup time using terracotta?
I’m in the middle of creating a conversion utility from one database to another, and I have to reinitialize my Hibernate configuration quite often. When you have a couple of hundred entities that need configuring, starting up Hibernate can take a long time. My initial thought was to serialize the SessionFactory and deserialize it upon each startup.
I didn’t try this yet, but something tells me this won’t work. Call it a nagging feeling. However, it should be possible to run the SessionFactory in a Terracotta cluster and keep that server alive, and connect my conversion utility on startup with the Terracotta cluster. This should make startup times a snap.
Mind you: this is just a thought experiment. If someone has done this before, leave a note!
September 26th, 2008 at 4:54 pm
Just in case you did not see this:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-1258
It seems like many have tried but….. it is not that easy
September 26th, 2008 at 5:04 pm
From the issue, they didn’t try keeping it running in a separate JVM using terracotta. I am convinced that using terracotta *will* speed up startup time considerably, provided that it works of course.
September 26th, 2008 at 8:06 pm
Martijn, you can serialize the object Configuration and from there, create an instance of SessionFactory.
Search within Hibernate’s documentation website.
Regards,
Bruno