Web hosting resellers - CHAPTER 13 Optimizing fetching and caching available memory.

CHAPTER 13 Optimizing fetching and caching available memory. You ll have to consult the JBoss Cache documentation for eviction policy configuration; the usage of Hibernate region names and eviction settings is similar to EHCache. JBoss Cache also supports invalidation instead of replication of modified data in a cluster, a potentially better performing choice. The Hibernate query cache, however, requires replication. You can also switch to OPTIMISTIC locking instead of pessimistic, again boosting scalability of the clustered cache. Doing so requires a different Hibernate cache provider plug-in, org.hibernte.cache.OptimisticTreeCacheProvider. Finally, let s look at the JGroups cluster communication configuration. The order of communication protocols is extremely important, so don t change or add lines randomly. Most interesting is the first protocol, . The loopback attribute must be set to true if node A is a Microsoft Windows machine (it isn t in this case). The other JGroups attributes are more complex and can be found in the JGroups documentation. They deal with the discovery algorithms used to detect new nodes in a group, failure detection, and, in general, the management of the group communication. After changing the cache concurrency strategy of your persistent classes to transactional (or read-only) and creating a treecache.xml file for node A, you can start up your application and look at the log output. We recommend enabling DEBUG logging for the org.jboss.cache package; you ll then see how JBoss Cache reads the configuration and reports node A as the first node in the cluster. To deploy node B, deploy the application on that node; no configuration file needs to be changed (if the second node also isn t a Microsoft Windows machine). If you start this second node, you should see join messages on both nodes. Your Hibernate application now uses fully transactional caching in a cluster. There is one final optional setting to consider. For cluster cache providers, it may be better to set the Hibernate configuration option hibernate.cache.use_ minimal_puts to true. When this setting is enabled, Hibernate adds an item to the cache only after checking to ensure that the item isn t already cached. This strategy performs better if cache writes (puts) are much more expensive than cache reads (gets). This is the case for a replicated cache in a cluster, but not for a local cache or a cache provider that relies on invalidation instead of replication. No matter if you re using a cluster or a local cache, you sometimes need to control it programmatically, either for testing or tuning purposes.
Check Tomcat Web Hosting services for best quality webspace to host your web application.

Leave a Reply