Reputation: 399
I want to create a cluster of web application which is developed with servlet and JSP. Now I need to cache data across instance, so any body can help me on the steps to configure this, any reference or any pointer be helpful. thanks in advance
Upvotes: 0
Views: 154
Reputation: 1294
Yes, you can. I answered a similar question just now and I believe it holds good for this scenario as well.
My suggestion would be to make use of NearCache feature of Hazelcast clients so you can de-couple the Hazelcast node from tomcat.
Hazelcast Cluster: Setup a Hazelcast cluster with the IMap configuration and implement a MapStore which should take care of loading the IMap with the cache eligible segments. Also make use of Event Handlers to take care of refreshing the cache.
Tomcat Servlet Layer: Startup the Hazelcast clients on each of the tomcat servers and enable the NearCache on those clients. Once the Hazelcast client is up, the NearCache settings will take care of sync'ing the contents from its cluster. Both the tomcat instances would be up-to-date with the cache contents.
Things to remember:
Let me know if this suits your architecture and have any questions.
Reference for NearCache:
http://docs.hazelcast.org/docs/3.6/manual/html-single/index.html#configuring-client-near-cache
Upvotes: 1