SlideShare ist ein Scribd-Unternehmen logo
1 von 49
Clustering Made Easier Using Terracotta with Hibernate and/or Ehcache Cris J. Holdorph Software Architect Unicon, Inc. Jasig Conference San Diego, CA March 9, 2010 © Copyright Unicon, Inc., 2008.  Some rights reserved.  This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License. To view a copy of this license, visit  http://creativecommons.org/licenses/by-nc-sa/3.0/us/
Speaker Bio ,[object Object]
Java Developer since 1997
Unicon Employee since 1998 ,[object Object]
uPortal
Sakai
Miscellaneous Professional Services ,[object Object]
Agenda ,[object Object]
Using Ehcache
Using Ehcache with Terracotta
Using Hibernate
Using Hibernate with 2cd level cache
Terracotta Server
Other Considerations
Technologies
Technologies ,[object Object]
Hibernate
Terracotta
Spring Framework
Ehcache ,[object Object]
Used by both uPortal and Sakai
Hibernate ,[object Object]
JPA implementation ,[object Object],[object Object],[object Object]
Used by both uPortal and Sakai
Terracotta ,[object Object]
Clustered Caching Platform
Network Attached Memory ,[object Object],[object Object],[object Object]
Open Source and Commercial
Unicon Partner
Many Terracotta employees are avid Twitter users
Spring Framework ,[object Object]
Multipurpose Java development libraries
And more... ,[object Object],[object Object],[object Object]
Strong integration with Ehcache, Hibernate
Some integration with Terracotta
Used by both uPortal and Sakai
Using Ehcache
Sample Application ,[object Object]
Form View ,[object Object]
Sample Application (screenshots)
Sample Application (screenshots)
pom.xml <dependency> <groupId>net.sf.ehcache</groupId> <artifactId>ehcache-core</artifactId> <version>1.7.2</version> </dependency> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-jdk14</artifactId> <version>1.5.8</version> </dependency>
ehcache.xml <ehcache> <diskStore path=&quot;java.io.tmpdir&quot; /> <defaultCache maxElementsInMemory=&quot;10&quot; eternal=&quot;false&quot; timeToIdleSeconds=&quot;120&quot; timeToLiveSeconds=&quot;300&quot; overflowToDisk=&quot;true&quot; /> <cache name=&quot;PEOPLE_CACHE&quot; maxElementsInMemory=&quot;2000&quot; eternal=&quot;false&quot; overflowToDisk=&quot;true&quot; timeToIdleSeconds=&quot;0&quot; timeToLiveSeconds=&quot;3600&quot; /> </ehcache>
CensusCollectServlet.java import net.sf.ehcache.Cache; import net.sf.ehcache.CacheManager; import net.sf.ehcache.Element; … private Cache peopleCache = null; … public void init(ServletConfig config) throws ServletException { super.init(config); CacheManager manager = new CacheManager(); peopleCache = manager.getCache(&quot;PEOPLE_CACHE&quot;); } ...
CensusCollectServlet.java ... Person person = null; Element element = peopleCache.get(ssn); if (person == null) { person = new Person(); } else { person = (Person)element.getValue(); } request.setAttribute(PERSON, person); ... peopleCache.put(new Element(ssn, person)); ...
Using Ehcache with RMI Replication
ehcache.xml <cacheManagerPeerProviderFactory class=&quot;net.sf.ehcache.distribution. RMICacheManagerPeerProviderFactory&quot; properties=&quot;hostName=fully_qualified_hostname_or_ip, peerDiscovery=automatic, multicastGroupAddress=230.0.0.1, multicastGroupPort=4446, timeToLive=32&quot;/> <cache name=&quot; PEOPLE_CACHE &quot; ...> <cacheEventListenerFactory class=&quot;net.sf.ehcache.distribution.RMICacheReplicatorFactory” properties=&quot;replicateAsynchronously=true, replicatePuts=true, replicatePutsViaCopy=false, replicateUpdates=true, replicateUpdatesViaCopy=true, replicateRemovals=true asynchronousReplicationIntervalMillis=1000&quot;/> </cache>
Using Ehcache with Terracotta
pom.xml <dependency> <groupId>net.sf.ehcache</groupId> <artifactId>ehcache-core</artifactId> <version>1.7.2</version> </dependency> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-jdk14</artifactId> <version>1.5.8</version> </dependency> <dependency> <groupId>net.sf.ehcache</groupId> <artifactId>ehcache-terracotta</artifactId> <version>1.8.0</version> </dependency>

Weitere ähnliche Inhalte

Was ist angesagt?

[CB16] Esoteric Web Application Vulnerabilities by Andrés Riancho
[CB16] Esoteric Web Application Vulnerabilities by Andrés Riancho[CB16] Esoteric Web Application Vulnerabilities by Andrés Riancho
[CB16] Esoteric Web Application Vulnerabilities by Andrés Riancho
CODE BLUE
 
V2 peter-lubbers-sf-jug-websocket
V2 peter-lubbers-sf-jug-websocketV2 peter-lubbers-sf-jug-websocket
V2 peter-lubbers-sf-jug-websocket
brent bucci
 
[CB16] 80時間でWebを一周:クロムミウムオートメーションによるスケーラブルなフィンガープリント by Isaac Dawson
[CB16] 80時間でWebを一周:クロムミウムオートメーションによるスケーラブルなフィンガープリント by Isaac Dawson[CB16] 80時間でWebを一周:クロムミウムオートメーションによるスケーラブルなフィンガープリント by Isaac Dawson
[CB16] 80時間でWebを一周:クロムミウムオートメーションによるスケーラブルなフィンガープリント by Isaac Dawson
CODE BLUE
 

Was ist angesagt? (20)

How to Implement Token Authentication Using the Django REST Framework
How to Implement Token Authentication Using the Django REST FrameworkHow to Implement Token Authentication Using the Django REST Framework
How to Implement Token Authentication Using the Django REST Framework
 
Construire son JDK en 10 étapes
Construire son JDK en 10 étapesConstruire son JDK en 10 étapes
Construire son JDK en 10 étapes
 
Maven 3.0 at Øredev
Maven 3.0 at ØredevMaven 3.0 at Øredev
Maven 3.0 at Øredev
 
WebRTC 101 - How to get started building your first WebRTC application
WebRTC 101 - How to get started building your first WebRTC applicationWebRTC 101 - How to get started building your first WebRTC application
WebRTC 101 - How to get started building your first WebRTC application
 
[CB16] Esoteric Web Application Vulnerabilities by Andrés Riancho
[CB16] Esoteric Web Application Vulnerabilities by Andrés Riancho[CB16] Esoteric Web Application Vulnerabilities by Andrés Riancho
[CB16] Esoteric Web Application Vulnerabilities by Andrés Riancho
 
Mobile Device APIs
Mobile Device APIsMobile Device APIs
Mobile Device APIs
 
110828recruit agent ws
110828recruit agent ws110828recruit agent ws
110828recruit agent ws
 
OSXCollector: Automated forensic evidence collection & analysis for OS X (Bru...
OSXCollector: Automated forensic evidence collection & analysis for OS X (Bru...OSXCollector: Automated forensic evidence collection & analysis for OS X (Bru...
OSXCollector: Automated forensic evidence collection & analysis for OS X (Bru...
 
V2 peter-lubbers-sf-jug-websocket
V2 peter-lubbers-sf-jug-websocketV2 peter-lubbers-sf-jug-websocket
V2 peter-lubbers-sf-jug-websocket
 
Craft 2019 - “The Upside Down” Of The Web - Video technologies
Craft 2019 - “The Upside Down” Of The Web - Video technologiesCraft 2019 - “The Upside Down” Of The Web - Video technologies
Craft 2019 - “The Upside Down” Of The Web - Video technologies
 
Asynchronous Programming at Netflix
Asynchronous Programming at NetflixAsynchronous Programming at Netflix
Asynchronous Programming at Netflix
 
How to create a real time chat application using socket.io, golang, and vue js-
How to create a real time chat application using socket.io, golang, and vue js-How to create a real time chat application using socket.io, golang, and vue js-
How to create a real time chat application using socket.io, golang, and vue js-
 
URL to HTML
URL to HTMLURL to HTML
URL to HTML
 
2020-02-20 - HashiCorpUserGroup Madring - Integrating HashiCorp Vault and Kub...
2020-02-20 - HashiCorpUserGroup Madring - Integrating HashiCorp Vault and Kub...2020-02-20 - HashiCorpUserGroup Madring - Integrating HashiCorp Vault and Kub...
2020-02-20 - HashiCorpUserGroup Madring - Integrating HashiCorp Vault and Kub...
 
Reversing & malware analysis training part 3 windows pe file format basics
Reversing & malware analysis training part 3   windows pe file format basicsReversing & malware analysis training part 3   windows pe file format basics
Reversing & malware analysis training part 3 windows pe file format basics
 
Aplicações HTML5 com Java EE 7 e NetBeans
Aplicações HTML5 com Java EE 7 e NetBeansAplicações HTML5 com Java EE 7 e NetBeans
Aplicações HTML5 com Java EE 7 e NetBeans
 
PuppetConf 2016: Puppet Troubleshooting – Thomas Uphill, Wells Fargo
PuppetConf 2016: Puppet Troubleshooting – Thomas Uphill, Wells FargoPuppetConf 2016: Puppet Troubleshooting – Thomas Uphill, Wells Fargo
PuppetConf 2016: Puppet Troubleshooting – Thomas Uphill, Wells Fargo
 
REST in ( a mobile ) peace @ WHYMCA 05-21-2011
REST in ( a mobile ) peace @ WHYMCA 05-21-2011REST in ( a mobile ) peace @ WHYMCA 05-21-2011
REST in ( a mobile ) peace @ WHYMCA 05-21-2011
 
PuppetConf 2016: Nice and Secure: Good OpSec Hygiene With Puppet! – Peter Sou...
PuppetConf 2016: Nice and Secure: Good OpSec Hygiene With Puppet! – Peter Sou...PuppetConf 2016: Nice and Secure: Good OpSec Hygiene With Puppet! – Peter Sou...
PuppetConf 2016: Nice and Secure: Good OpSec Hygiene With Puppet! – Peter Sou...
 
[CB16] 80時間でWebを一周:クロムミウムオートメーションによるスケーラブルなフィンガープリント by Isaac Dawson
[CB16] 80時間でWebを一周:クロムミウムオートメーションによるスケーラブルなフィンガープリント by Isaac Dawson[CB16] 80時間でWebを一周:クロムミウムオートメーションによるスケーラブルなフィンガープリント by Isaac Dawson
[CB16] 80時間でWebを一周:クロムミウムオートメーションによるスケーラブルなフィンガープリント by Isaac Dawson
 

Ähnlich wie Clustering Made Easier: Using Terracotta with Hibernate and/or EHCache

Terracotta Ch'ti Jug
Terracotta Ch'ti JugTerracotta Ch'ti Jug
Terracotta Ch'ti Jug
Ch'ti JUG
 
GTLAB Installation Tutorial for SciDAC 2009
GTLAB Installation Tutorial for SciDAC 2009GTLAB Installation Tutorial for SciDAC 2009
GTLAB Installation Tutorial for SciDAC 2009
marpierc
 
GTAC: AtomPub, testing your server implementation
GTAC: AtomPub, testing your server implementationGTAC: AtomPub, testing your server implementation
GTAC: AtomPub, testing your server implementation
David Calavera
 
Slides Aquarium Paris 2008
Slides Aquarium Paris 2008Slides Aquarium Paris 2008
Slides Aquarium Paris 2008
julien.ponge
 
10reasons
10reasons10reasons
10reasons
Li Huan
 

Ähnlich wie Clustering Made Easier: Using Terracotta with Hibernate and/or EHCache (20)

Terracotta Ch'ti Jug
Terracotta Ch'ti JugTerracotta Ch'ti Jug
Terracotta Ch'ti Jug
 
Ajax to the Moon
Ajax to the MoonAjax to the Moon
Ajax to the Moon
 
Internet Explorer 8 for Developers by Christian Thilmany
Internet Explorer 8 for Developers by Christian ThilmanyInternet Explorer 8 for Developers by Christian Thilmany
Internet Explorer 8 for Developers by Christian Thilmany
 
Demystifying Maven
Demystifying MavenDemystifying Maven
Demystifying Maven
 
IMS Learning Tools Interoperability @ UCLA
IMS Learning Tools Interoperability @ UCLAIMS Learning Tools Interoperability @ UCLA
IMS Learning Tools Interoperability @ UCLA
 
REST dojo Comet
REST dojo CometREST dojo Comet
REST dojo Comet
 
Teflon - Anti Stick for the browser attack surface
Teflon - Anti Stick for the browser attack surfaceTeflon - Anti Stick for the browser attack surface
Teflon - Anti Stick for the browser attack surface
 
Spring Surf 101
Spring Surf 101Spring Surf 101
Spring Surf 101
 
Creating Yahoo Mobile Widgets
Creating Yahoo Mobile WidgetsCreating Yahoo Mobile Widgets
Creating Yahoo Mobile Widgets
 
Accelerated Adoption: HTML5 and CSS3 for ASP.NET Developers
Accelerated Adoption: HTML5 and CSS3 for ASP.NET DevelopersAccelerated Adoption: HTML5 and CSS3 for ASP.NET Developers
Accelerated Adoption: HTML5 and CSS3 for ASP.NET Developers
 
GTLAB Installation Tutorial for SciDAC 2009
GTLAB Installation Tutorial for SciDAC 2009GTLAB Installation Tutorial for SciDAC 2009
GTLAB Installation Tutorial for SciDAC 2009
 
Jsp
JspJsp
Jsp
 
dJango
dJangodJango
dJango
 
IBM Lotus Notes Domino XPages and XPages for Mobile
IBM Lotus Notes Domino XPages and XPages for MobileIBM Lotus Notes Domino XPages and XPages for Mobile
IBM Lotus Notes Domino XPages and XPages for Mobile
 
GTAC: AtomPub, testing your server implementation
GTAC: AtomPub, testing your server implementationGTAC: AtomPub, testing your server implementation
GTAC: AtomPub, testing your server implementation
 
Slides Aquarium Paris 2008
Slides Aquarium Paris 2008Slides Aquarium Paris 2008
Slides Aquarium Paris 2008
 
10reasons
10reasons10reasons
10reasons
 
Front End Website Optimization
Front End Website OptimizationFront End Website Optimization
Front End Website Optimization
 
Introduction to SDshare
Introduction to SDshareIntroduction to SDshare
Introduction to SDshare
 
An Introduction to Solr
An Introduction to SolrAn Introduction to Solr
An Introduction to Solr
 

Mehr von Cris Holdorph

Mehr von Cris Holdorph (9)

Programming for Performance
Programming for PerformanceProgramming for Performance
Programming for Performance
 
Introduction to International MyLabs
Introduction to International MyLabsIntroduction to International MyLabs
Introduction to International MyLabs
 
Using Sakai Site Archive for Good not Evil
Using Sakai Site Archive for Good not EvilUsing Sakai Site Archive for Good not Evil
Using Sakai Site Archive for Good not Evil
 
No SQL Technologies
No SQL TechnologiesNo SQL Technologies
No SQL Technologies
 
Developing JSR 286 Portlets
Developing JSR 286 PortletsDeveloping JSR 286 Portlets
Developing JSR 286 Portlets
 
Adding Performance Testing to a Software Development Project
Adding Performance Testing to a Software Development ProjectAdding Performance Testing to a Software Development Project
Adding Performance Testing to a Software Development Project
 
Sakai and IMS LIS Integration
Sakai and IMS LIS IntegrationSakai and IMS LIS Integration
Sakai and IMS LIS Integration
 
Clustering Sakai with Terracotta
Clustering Sakai with TerracottaClustering Sakai with Terracotta
Clustering Sakai with Terracotta
 
Introduction to Terracotta
Introduction to TerracottaIntroduction to Terracotta
Introduction to Terracotta
 

Kürzlich hochgeladen

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 

Kürzlich hochgeladen (20)

MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 

Clustering Made Easier: Using Terracotta with Hibernate and/or EHCache

  • 1. Clustering Made Easier Using Terracotta with Hibernate and/or Ehcache Cris J. Holdorph Software Architect Unicon, Inc. Jasig Conference San Diego, CA March 9, 2010 © Copyright Unicon, Inc., 2008. Some rights reserved. This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/3.0/us/
  • 2.
  • 4.
  • 7.
  • 8.
  • 10. Using Ehcache with Terracotta
  • 12. Using Hibernate with 2cd level cache
  • 16.
  • 20.
  • 21. Used by both uPortal and Sakai
  • 22.
  • 23.
  • 24. Used by both uPortal and Sakai
  • 25.
  • 27.
  • 28. Open Source and Commercial
  • 30. Many Terracotta employees are avid Twitter users
  • 31.
  • 33.
  • 34. Strong integration with Ehcache, Hibernate
  • 35. Some integration with Terracotta
  • 36. Used by both uPortal and Sakai
  • 38.
  • 39.
  • 42. pom.xml <dependency> <groupId>net.sf.ehcache</groupId> <artifactId>ehcache-core</artifactId> <version>1.7.2</version> </dependency> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-jdk14</artifactId> <version>1.5.8</version> </dependency>
  • 43. ehcache.xml <ehcache> <diskStore path=&quot;java.io.tmpdir&quot; /> <defaultCache maxElementsInMemory=&quot;10&quot; eternal=&quot;false&quot; timeToIdleSeconds=&quot;120&quot; timeToLiveSeconds=&quot;300&quot; overflowToDisk=&quot;true&quot; /> <cache name=&quot;PEOPLE_CACHE&quot; maxElementsInMemory=&quot;2000&quot; eternal=&quot;false&quot; overflowToDisk=&quot;true&quot; timeToIdleSeconds=&quot;0&quot; timeToLiveSeconds=&quot;3600&quot; /> </ehcache>
  • 44. CensusCollectServlet.java import net.sf.ehcache.Cache; import net.sf.ehcache.CacheManager; import net.sf.ehcache.Element; … private Cache peopleCache = null; … public void init(ServletConfig config) throws ServletException { super.init(config); CacheManager manager = new CacheManager(); peopleCache = manager.getCache(&quot;PEOPLE_CACHE&quot;); } ...
  • 45. CensusCollectServlet.java ... Person person = null; Element element = peopleCache.get(ssn); if (person == null) { person = new Person(); } else { person = (Person)element.getValue(); } request.setAttribute(PERSON, person); ... peopleCache.put(new Element(ssn, person)); ...
  • 46. Using Ehcache with RMI Replication
  • 47. ehcache.xml <cacheManagerPeerProviderFactory class=&quot;net.sf.ehcache.distribution. RMICacheManagerPeerProviderFactory&quot; properties=&quot;hostName=fully_qualified_hostname_or_ip, peerDiscovery=automatic, multicastGroupAddress=230.0.0.1, multicastGroupPort=4446, timeToLive=32&quot;/> <cache name=&quot; PEOPLE_CACHE &quot; ...> <cacheEventListenerFactory class=&quot;net.sf.ehcache.distribution.RMICacheReplicatorFactory” properties=&quot;replicateAsynchronously=true, replicatePuts=true, replicatePutsViaCopy=false, replicateUpdates=true, replicateUpdatesViaCopy=true, replicateRemovals=true asynchronousReplicationIntervalMillis=1000&quot;/> </cache>
  • 48. Using Ehcache with Terracotta
  • 49. pom.xml <dependency> <groupId>net.sf.ehcache</groupId> <artifactId>ehcache-core</artifactId> <version>1.7.2</version> </dependency> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-jdk14</artifactId> <version>1.5.8</version> </dependency> <dependency> <groupId>net.sf.ehcache</groupId> <artifactId>ehcache-terracotta</artifactId> <version>1.8.0</version> </dependency>
  • 50. ehcache.xml <ehcache> <diskStore path=&quot;java.io.tmpdir&quot; /> <defaultCache maxElementsInMemory=&quot;10&quot; eternal=&quot;false&quot; timeToIdleSeconds=&quot;120&quot; timeToLiveSeconds=&quot;300&quot; overflowToDisk=&quot;true&quot; /> <terracottaConfig url=&quot;localhost:9510&quot;/> <cache name=&quot;PEOPLE_CACHE&quot; maxElementsInMemory=&quot;2000&quot; eternal=&quot;false&quot; overflowToDisk=&quot;true&quot; timeToIdleSeconds=&quot;0&quot; timeToLiveSeconds=&quot;3600&quot; <terracotta /> </cache> </ehcache>
  • 51. Terracotta Server $ terracotta-3.2.0/bin/start-tc-server.sh Start the Terracotta Server First The Terracotta server must be started before any applications that use Terracotta.
  • 53. hibernate.cfg.xml <!DOCTYPE hibernate-configuration PUBLIC &quot;-//Hibernate/Hibernate Configuration DTD 3.0//EN&quot; &quot;http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd&quot;> <hibernate-configuration> <session-factory> <property name=&quot;connection.driver_class&quot;>org.hsqldb.jdbcDriver</property> <property name=&quot;connection.url&quot;>jdbc:hsqldb:hsql://localhost:8887</property> <property name=&quot;connection.username&quot;>sa</property> <property name=&quot;connection.password&quot;></property> <property name=&quot;connection.pool_size&quot;>2</property> <property name=&quot;dialect&quot;>org.hibernate.dialect.HSQLDialect</property> . . .
  • 54. hibernate.cfg.xml (2) . . . <property name=&quot;current_session_context_class&quot;>org.hibernate.context.ManagedSessionContext</property> <property name=&quot;cache.provider_class&quot;> org.hibernate.cache.NoCacheProvider </property> <property name=&quot;show_sql&quot;>true</property> <property name=&quot;hbm2ddl.auto&quot;>validate</property> <mapping resource=&quot;org/jasig/census/Person.hbm.xml&quot;/> </session-factory> </hibernate-configuration>
  • 55. Person.hbm.xml <?xml version=&quot;1.0&quot;?> <!DOCTYPE hibernate-mapping PUBLIC &quot;-//Hibernate/Hibernate Mapping DTD 3.0//EN&quot; &quot;http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd&quot;> <hibernate-mapping package=&quot;org.jasig.census&quot;> <class name=&quot;Person&quot; table=&quot;PERSON&quot;> <cache usage=&quot;read-write&quot; /> <id name=&quot;id&quot; column=&quot;PERSON_ID&quot;> <generator class=&quot;native&quot;/> </id> <property name=&quot;name&quot;/> <property name=&quot;city&quot;/> <property name=&quot;state&quot;/> <property name=&quot;ssn&quot;/> </class> </hibernate-mapping>
  • 56. pom.xml <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-core</artifactId> <version>3.3.2.GA</version> </dependency> <dependency> <groupId>javassist</groupId> <artifactId>javassist</artifactId> <version>3.8.0.GA</version> </dependency> <dependency> <groupId>hsqldb</groupId> <artifactId>hsqldb</artifactId> <version>1.8.0.7</version> </dependency>
  • 57. getAllPeople() (.java code) public static List<?> getAllPeople() { SessionFactory sf = getSessionFactory(); Session session = sf.openSession(); session.beginTransaction(); List<?> result = session.createQuery(&quot;from Person&quot;).list(); session.getTransaction().commit(); session.close(); return result; }
  • 58. Using Hibernate with a Second Level Cache Ehcache
  • 59. pom.xml <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-core</artifactId> <version>3.3.2.GA</version> </dependency> <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-ehcache</artifactId> <version>3.3.2.GA</version> </dependency> <dependency> <groupId>javassist</groupId> <artifactId>javassist</artifactId> <version>3.8.0.GA</version> </dependency> . . .
  • 60. hibernate.cfg.xml . . . <property name=&quot;current_session_context_class&quot;>org.hibernate.context.ManagedSessionContext</property> <property name=&quot;use_second_level_cache&quot;>true</property> <property name=&quot;cache.provider_class&quot;>org.hibernate.cache.EhCacheProvider</property> <property name=&quot;show_sql&quot;>true</property> <property name=&quot;hbm2ddl.auto&quot;>validate</property> <mapping resource=&quot;org/jasig/census/Person.hbm.xml&quot;/> </session-factory> </hibernate-configuration>
  • 61. ehcache.xml <ehcache> <diskStore path=&quot;java.io.tmpdir&quot; /> <defaultCache maxElementsInMemory=&quot;10&quot; overflowToDisk=&quot;true&quot; timeToIdleSeconds=&quot;120&quot; timeToLiveSeconds=&quot;300&quot; eternal=&quot;false&quot; /> <cache name=&quot;org.jasig.census.Person&quot; maxElementsInMemory=&quot;10000&quot; eternal=&quot;false&quot; timeToIdleSeconds=&quot;3000&quot; timeToLiveSeconds=&quot;6000&quot; overflowToDisk=&quot;false&quot; /> <cache name=&quot;query.findAllPeople&quot; maxElementsInMemory=&quot;50&quot; eternal=&quot;false&quot; timeToLiveSeconds=&quot;86400&quot; overflowToDisk=&quot;false&quot; /> </ehcache>
  • 62. getAllPeople() (.java code) public static List<?> getAllPeople() { SessionFactory sf = getSessionFactory(); Session session = sf.openSession(); session.beginTransaction(); List<?> result = session.createQuery(&quot;from Person&quot;). setCacheable(true).setCacheRegion(&quot;query.findAllPeople&quot;). list(); session.getTransaction().commit(); session.close(); return result; }
  • 63. Using Hibernate with a Second Level Cache Terracotta
  • 64. pom.xml <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-core</artifactId> <version>3.3.2.GA</version> </dependency> <dependency> <groupId>org.terracotta.hibernate</groupId> <artifactId>terracotta-hibernate-cache</artifactId> <version>1.1.0</version> </dependency> <dependency> <groupId>javassist</groupId> <artifactId>javassist</artifactId> <version>3.8.0.GA</version> </dependency> . . .
  • 65. pom.xml (2) . . . <repositories> <repository> <id>terracotta-repository</id> <url>http://www.terracotta.org/download/reflector/maven2</url> <releases> <enabled>true</enabled> </releases> <snapshots> <enabled>true</enabled> </snapshots> </repository> </repositories> </project>
  • 66. hibernate.cfg.xml . . . <property name=&quot;current_session_context_class&quot;>org.hibernate.context.ManagedSessionContext</property> <property name=&quot;use_second_level_cache&quot;>true</property> <property name=&quot;cache.provider_class&quot;> org.terracotta.hibernate.TerracottaHibernateCacheProvider </property> <property name=&quot;show_sql&quot;>true</property> <property name=&quot;hbm2ddl.auto&quot;>validate</property> <mapping resource=&quot;org/jasig/census/Person.hbm.xml&quot;/> </session-factory> </hibernate-configuration>
  • 67. Terracotta Server $ /opt/terracotta-3.2.0/bin/start-tc-server.sh Start the Terracotta Server First The Terracotta server must be started before any applications that use Terracotta.
  • 68. Hibernate Application $ export JAVA_OPTS=&quot;-javaagent:/opt/terracotta-3.2.0/hibernate/terracotta-hibernate-agent-1.1.0.jar&quot; $ /opt/apache-tomcat-6.0.24/bin/startup.sh Start Application with Options The application must be started with special JAVA_OPTS set for Terracotta.
  • 70.
  • 71. Multiple Terracotta Servers in clustered mode
  • 72.
  • 73. Express mode vs Custom/Identity Mode
  • 74. Administration Console $ /opt/terracotta-3.2.0/bin/ dev-console.sh
  • 76.
  • 78.
  • 80.
  • 81. Service for system administrators to learn / support
  • 82.
  • 83. Twitter / Blogs are great
  • 84.
  • 85.
  • 86. Terracotta 3.2.0 requires Ehcache-terracotta 1.8.0
  • 87. Terracotta 3.2.1 (not yet released) will require Ehcache-terracotta 2.0.0
  • 88. Ehcache-Terracotta Express mode fully serializes objects
  • 89. Ehcache-Custom mode (also called Identity mode) requires custom tc-config.xml file
  • 90.
  • 91.
  • 92.
  • 93.
  • 96. Questions & Answers Cris J. Holdorph Software Architect Unicon, Inc. [email_address] www.unicon.net