Persisting data in disk Hibernate 2nd level Hazelcast cluster cache upon shutdown

437 views
Skip to first unread message

Franz Allan Valencia See

unread,
Jul 29, 2010, 11:45:12 AM7/29/10
to haze...@googlegroups.com
Is it possible to persist data in disk (or somewhere else that can be read fast) when the Hibernate 2nd level Hazelcast cluster cache shuts down?

The reason I ask is because I'm planning to preload my entities from the database to the Hibernate 2nd level cache during application startup, and since that process will take a significant amount of time to run, I'm wondering if there's a way to persist those entities unto the disk upon cluster shutdown so that on the next startup, it will just read from the disk and avoid the db roundtrips, thereby speeding up the succeeding start ups.

Thanks,
--
Franz Allan Valencia See | Java Software Engineer
fran...@gmail.com
LinkedIn: http://www.linkedin.com/in/franzsee
Twitter: http://www.twitter.com/franz_see

Mehmet Dogan

unread,
Jul 29, 2010, 4:07:36 PM7/29/10
to haze...@googlegroups.com
Built-in file based storage is highly requested , and it is in planned features list.
when this is implemented into Hazelcast, Hibernate 2nd level cache will have disk persistence feature.

With disk storage entities over some threshold (through some algorithm; LFU/LRU) may be persisted into disk, and also as you suggested all in memory items can be persisted on shutdown and loaded on startup.

I maybe miss-understood you, if so I beg your pardon; but I am not sure about pre-loading entities into 2nd level cache without knowledge of Hibernate. I think  management of 2nd level cache should be left to Hibernate itself and all entity operations should be done over Hibernate.

@mm


--
You received this message because you are subscribed to the Google Groups "Hazelcast" group.
To post to this group, send email to haze...@googlegroups.com.
To unsubscribe from this group, send email to hazelcast+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/hazelcast?hl=en.

Franz Allan Valencia See

unread,
Jul 29, 2010, 10:24:40 PM7/29/10
to haze...@googlegroups.com
That sounds great. Pardon, where is the feature request for that? I would like to 'watch' it so that I can keep track of its progress :-) ..also, are there any tentative date for the release which will contain that feature (because I'm planning to hack it out myself)? :-)

Re: pre-loading
My plan is to have another application running besides my main applications, let's call this my "replication-manager". replication-manager's job is to handle all things related to replication, which means the pre-loading and the scheduled refreshes. And replication-manager will share its 2nd level hibernate cache with my other applications. Thus, when those other applications starts up, they will just join replication-manager and the cached entities would already be available to them.

Also, I'm planning to index these entities via Compass/HibernateSearch and store the lucene document in Hazelcast (any tips on this one? :D ). That's because currently, some of our sql searches are pretty slow which is why I want to replicate these data into a lucene document and conduct my searches there instead. And since those tables are my whole search space, I would need to replicate them as a whole and not just an on-demand. These replication to a Lucene document would also be handled by "replication-manager".

So idealy, I will not need to persist to the disk because the cached entities and the lucene documents will be available once an application joins replication-manager. But while developing against replication-manager itself, it can be really useful.


Thanks,

--
Franz Allan Valencia See | Java Software Engineer
fran...@gmail.com
LinkedIn: http://www.linkedin.com/in/franzsee
Twitter: http://www.twitter.com/franz_see

Mehmet Dogan

unread,
Jul 30, 2010, 4:29:23 AM7/30/10
to haze...@googlegroups.com
I guess too many requested file persistence but nobody actually created a feature request issue. You may the one. :)

It is sitting on planned features list, but seems it will not be implemented in short term.

Franz Allan Valencia See

unread,
Jul 30, 2010, 4:39:33 AM7/30/10
to haze...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages