SlideShare ist ein Scribd-Unternehmen logo
1 von 28
Introduction to
                                                           Terracotta
                                                                                             Cris J. Holdorph
                                                                                                 Software Architect
                                                                                                       Unicon, Inc.

                                                                                                 Sakai Conference
                                                                                                   Cambridge, MA
                                                                                                     July 9, 2009




© Copyright Unicon, Inc., 2009. 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/
Agenda
1. Introduction
2. Main Parts
3. Terracotta Integration Modules
4. Hello World
5. Lessons Learned using Terracotta
6. Different Uses for Terracotta
7. Resources
                                      2
Introduction




               3
Introduction
●
    Terracotta is...
    –   A Distributed Cache
    –   A Distributed Session Server
    –   Network Attached Memory


●
    Terracotta is...
    –   Open Source
    –   Java
    –   Client / Server

                                       4
Main Parts




             5
Main Parts
●
    Terracotta Server
    –   tc-config.xml


●
    Terracotta Enabled Application
    –   tc-config.xml
    –   JAVA_OPTS


●
    Terracotta Administration Console


                                        6
7
tc-config.xml
●
    Roots
●
    Locks
●
    Instrumented Classes
●
    Transient Fields
    –   Marking
    –   Resolving




                                    8
Configuring Roots in tc-config.xml

   <roots>
    <root>
      <field-name>org.pkg.MyClass.aField</field-name>
    </root>
    <root>
      <field-name>org.pkg.MyClass.field2</field-name>
    </root>
   </roots>




                                                        9
Terracotta Locks
●
    Four types of locks
    –   write (default)
    –   synchronous-write
    –   read
    –   concurrent (discouraged)
●
    All changes to a Terracotta managed object
    must be done in the scope of a lock
●
    You do not need a lock on the object you are
    changing
●
    Locks are the Transactions of Terracotta
                                                 10
Configuring Locks in tc-config.xml

<locks>
  <autolock auto-synchronized="false">
    <method-expression>*
org.pkg.MyClass.method(..)</method-expression>
    <lock-level>write</lock-level>
  </autolock>
  <autolock auto-synchronized="false">
    <method-expression>* org.pkg.SomeClass$Inny.run(..)</
method-expression>
    <lock-level>write</lock-level>
  </autolock>
</locks>

                                                            11
Instrumented Classes
●
    Each instrumented class can or must
    configure the following section
    –   class-expression (required)
    –   honor-transient (optional)
    –   on-load (optional)
●
    Optional instrumented-classes section
    –   exclude (optional)




                                            12
Configuring Instrumented
          Classes in tc-config.xml
<instrumented-classes>
  <include>
      <class-expression>org.pkg.MyClass</class-expression>
      <honor-transient>true</honor-transient>
      <on-load><execute><![CDATA[self.log =
org.apache.commons.logging.LogFactory.getLog(org.pkg.MyClass.class);
]]></execute></on-load>
  </include>
  <include>
      <class-expression>org.pkg.YourClass</class-expression>
      <honor-transient>true</honor-transient>
      <on-load>
        <method>resolveTransientFields</method>
      </on-load>
  </include>
</instrumented-classes>                                           13
Resolving Transient Fields
●
    Transient Fields may be specified 2 ways
    –   Transient keyword in the Java source file and
        corresponding property to honor transient
        keyword in tc-config.xml
    –   Explicitly declaring a field as transient in the tc-
        config.xml file
●
    Transient Fields may be resolved in 2 ways
    –   BeanShell script in tc-config.xml
    –   Calling a method on the resolved object


                                                               14
Resolving a Transient Field with
            BeanShell
<instrumented-classes>
  <include>
      <class-expression>org.pkg.MyClass</class-expression>
      <honor-transient>true</honor-transient>
      <on-load>
        <execute><![CDATA[self.log =
org.apache.commons.logging.LogFactory.getLog(org.pkg.MyClass.cla
ss);]]></execute>
      </on-load>
  </include>
</instrumented-classes>




                                                                   15
Resolving a Transient Field with Java
 <instrumented-classes>
   <include>
       <class-expression>org.pkg.YourClass</class-expression>
       <honor-transient>true</honor-transient>
       <on-load>
         <method>resolveTransientFields</method>
       </on-load>
   </include>
 </instrumented-classes>




                                                                16
Terracotta Integration
       Modules




                         17
Terracotta Integration Modules
●
    TIM (Terracotta Integration Module)
    –   OSGi bundle
    –   Maven artifact


●
    Use to decompose your tc-config.xml
●
    Let different application components manage
    their own tc-config.xml configuration bits
●
    Maven support for building a TIM


                                             18
Using a TIM in tc-config.xml

<clients>
   <logs>/var/logs/terracotta/client/</logs>
   <statistics>/var/logs/terracotta/clientstats</statistics>
   <modules>
      <repository>/opt/local/tc-repo/</repository>
      <module name="tim-mytim" version="1.2.3" group-
id="org.pkg"/>
      <module name="tim-yourtim" version="2.0.7" group-
id="org.pkg"/>
   </modules>
</clients>



                                                          19
Creating a TIM with Maven

       <plugins>
         <plugin>
           <groupId>org.terracotta.maven.plugins</groupId>
           <artifactId>tc-maven-plugin</artifactId>
         </plugin>
         <plugin>
           <groupId>org.apache.maven.plugins</groupId>
           <artifactId>maven-jar-plugin</artifactId>
         </plugin>
       </plugins>


For a complete example look at the following pom.xml file
https://source.sakaiproject.org/svn/kernel/trunk/kernel-tim/pom.xml
                                                                      20
Lessons Learned




                  21
Lessons Learned
●
    Serializable, Transient, Synchronization
●
    Course Grained Locking versus Fine Grained
    Locking
●
    Cluster-wide Locking
●
    TIMs




                                               22
Lessons Learned
●
    Partitioning your data
    –   Avoiding iterating over all objects in a Root
        collection
●
    Minor field updates vs Full object
    replacements
●
    Instrumenting ALL classes that access shared
    objects
●
    Avoid direct field access (use setters instead)
●
    Avoid non-static inner classes (they require
    storage of the outer class)
                                                        23
Different Uses for
    Terracotta




                     24
Different Uses for Terracotta
●
    Clustering your application for server failover
    –   Transparent session migration
●
    Hibernate second level cache mirroring
●
    General purpose cache mirroring
●
    Pseudo Object Database




                                                 25
Resources




            26
Resources
●
    Cluster-enabling Sakai with Terracotta
     –   Tuesday, 10:15 am
●
    Websites
     –   Open Source http://www.terracotta.org/
     –   Commercial http://www.terracottatech.com/
●
    Website Resources
     –   Downloads
     –   Documentation
     –   Forums
●
    Book
     –   The Definitive Guide to Terracotta, ISBN-13: 978-
         1590599860
                                                             27
Questions & Answers




          Cris J. Holdorph
          Software Architect
          Unicon, Inc.

          holdorph@unicon.net
          www.unicon.net



                                28

Weitere ähnliche Inhalte

Was ist angesagt?

Logging Last Resource Optimization for Distributed Transactions in Oracle…
Logging Last Resource Optimization for Distributed Transactions in  Oracle…Logging Last Resource Optimization for Distributed Transactions in  Oracle…
Logging Last Resource Optimization for Distributed Transactions in Oracle…Gera Shegalov
 
MariaDB Server on macOS - FOSDEM 2022 MariaDB Devroom
MariaDB Server on macOS -  FOSDEM 2022 MariaDB DevroomMariaDB Server on macOS -  FOSDEM 2022 MariaDB Devroom
MariaDB Server on macOS - FOSDEM 2022 MariaDB DevroomValeriy Kravchuk
 
MySQL Parallel Replication: inventory, use-cases and limitations
MySQL Parallel Replication: inventory, use-cases and limitationsMySQL Parallel Replication: inventory, use-cases and limitations
MySQL Parallel Replication: inventory, use-cases and limitationsJean-François Gagné
 
MySQL Parallel Replication: inventory, use-case and limitations
MySQL Parallel Replication: inventory, use-case and limitationsMySQL Parallel Replication: inventory, use-case and limitations
MySQL Parallel Replication: inventory, use-case and limitationsJean-François Gagné
 
MySQL/MariaDB Parallel Replication: inventory, use-case and limitations
MySQL/MariaDB Parallel Replication: inventory, use-case and limitationsMySQL/MariaDB Parallel Replication: inventory, use-case and limitations
MySQL/MariaDB Parallel Replication: inventory, use-case and limitationsJean-François Gagné
 
Logging Last Resource Optimization for Distributed Transactions in Oracle We...
Logging Last Resource Optimization for Distributed Transactions in  Oracle We...Logging Last Resource Optimization for Distributed Transactions in  Oracle We...
Logging Last Resource Optimization for Distributed Transactions in Oracle We...Gera Shegalov
 
MySQL Parallel Replication (LOGICAL_CLOCK): all the 5.7 (and some of the 8.0)...
MySQL Parallel Replication (LOGICAL_CLOCK): all the 5.7 (and some of the 8.0)...MySQL Parallel Replication (LOGICAL_CLOCK): all the 5.7 (and some of the 8.0)...
MySQL Parallel Replication (LOGICAL_CLOCK): all the 5.7 (and some of the 8.0)...Jean-François Gagné
 
Riding the Binlog: an in Deep Dissection of the Replication Stream
Riding the Binlog: an in Deep Dissection of the Replication StreamRiding the Binlog: an in Deep Dissection of the Replication Stream
Riding the Binlog: an in Deep Dissection of the Replication StreamJean-François Gagné
 
Managing and Visualizing your Replication Topologies with Orchestrator
Managing and Visualizing your Replication Topologies with OrchestratorManaging and Visualizing your Replication Topologies with Orchestrator
Managing and Visualizing your Replication Topologies with OrchestratorShlomi Noach
 
Configuration management I - Ansible + Packer
Configuration management I - Ansible + PackerConfiguration management I - Ansible + Packer
Configuration management I - Ansible + PackerXavier Serrat Bordas
 
Running Pharo on the GemStone VM
Running Pharo on the GemStone VMRunning Pharo on the GemStone VM
Running Pharo on the GemStone VMESUG
 

Was ist angesagt? (13)

Logging Last Resource Optimization for Distributed Transactions in Oracle…
Logging Last Resource Optimization for Distributed Transactions in  Oracle…Logging Last Resource Optimization for Distributed Transactions in  Oracle…
Logging Last Resource Optimization for Distributed Transactions in Oracle…
 
MariaDB Server on macOS - FOSDEM 2022 MariaDB Devroom
MariaDB Server on macOS -  FOSDEM 2022 MariaDB DevroomMariaDB Server on macOS -  FOSDEM 2022 MariaDB Devroom
MariaDB Server on macOS - FOSDEM 2022 MariaDB Devroom
 
MySQL Parallel Replication: inventory, use-cases and limitations
MySQL Parallel Replication: inventory, use-cases and limitationsMySQL Parallel Replication: inventory, use-cases and limitations
MySQL Parallel Replication: inventory, use-cases and limitations
 
MySQL Parallel Replication: inventory, use-case and limitations
MySQL Parallel Replication: inventory, use-case and limitationsMySQL Parallel Replication: inventory, use-case and limitations
MySQL Parallel Replication: inventory, use-case and limitations
 
MySQL/MariaDB Parallel Replication: inventory, use-case and limitations
MySQL/MariaDB Parallel Replication: inventory, use-case and limitationsMySQL/MariaDB Parallel Replication: inventory, use-case and limitations
MySQL/MariaDB Parallel Replication: inventory, use-case and limitations
 
Logging Last Resource Optimization for Distributed Transactions in Oracle We...
Logging Last Resource Optimization for Distributed Transactions in  Oracle We...Logging Last Resource Optimization for Distributed Transactions in  Oracle We...
Logging Last Resource Optimization for Distributed Transactions in Oracle We...
 
MySQL Parallel Replication (LOGICAL_CLOCK): all the 5.7 (and some of the 8.0)...
MySQL Parallel Replication (LOGICAL_CLOCK): all the 5.7 (and some of the 8.0)...MySQL Parallel Replication (LOGICAL_CLOCK): all the 5.7 (and some of the 8.0)...
MySQL Parallel Replication (LOGICAL_CLOCK): all the 5.7 (and some of the 8.0)...
 
Riding the Binlog: an in Deep Dissection of the Replication Stream
Riding the Binlog: an in Deep Dissection of the Replication StreamRiding the Binlog: an in Deep Dissection of the Replication Stream
Riding the Binlog: an in Deep Dissection of the Replication Stream
 
Managing and Visualizing your Replication Topologies with Orchestrator
Managing and Visualizing your Replication Topologies with OrchestratorManaging and Visualizing your Replication Topologies with Orchestrator
Managing and Visualizing your Replication Topologies with Orchestrator
 
Configuration management I - Ansible + Packer
Configuration management I - Ansible + PackerConfiguration management I - Ansible + Packer
Configuration management I - Ansible + Packer
 
Running Pharo on the GemStone VM
Running Pharo on the GemStone VMRunning Pharo on the GemStone VM
Running Pharo on the GemStone VM
 
FlashCache
FlashCacheFlashCache
FlashCache
 
NoSQL with MySQL
NoSQL with MySQLNoSQL with MySQL
NoSQL with MySQL
 

Ähnlich wie Introduction to Terracotta

Clustering Sakai with Terracotta
Clustering Sakai with TerracottaClustering Sakai with Terracotta
Clustering Sakai with TerracottaCris Holdorph
 
Java and Containers - Make it Awesome !
Java and Containers - Make it Awesome !Java and Containers - Make it Awesome !
Java and Containers - Make it Awesome !Dinakar Guniguntala
 
Lightweight Grids With Terracotta
Lightweight Grids With TerracottaLightweight Grids With Terracotta
Lightweight Grids With TerracottaPT.JUG
 
Ob1k presentation at Java.IL
Ob1k presentation at Java.ILOb1k presentation at Java.IL
Ob1k presentation at Java.ILEran Harel
 
Terracotta Ch'ti Jug
Terracotta Ch'ti JugTerracotta Ch'ti Jug
Terracotta Ch'ti JugCh'ti JUG
 
State of Java Elasticity. Tuning Java Efficiency - GIDS.JAVA LIVE 2020
State of Java Elasticity. Tuning Java Efficiency - GIDS.JAVA LIVE 2020State of Java Elasticity. Tuning Java Efficiency - GIDS.JAVA LIVE 2020
State of Java Elasticity. Tuning Java Efficiency - GIDS.JAVA LIVE 2020Jelastic Multi-Cloud PaaS
 
JVM Performance Tuning
JVM Performance TuningJVM Performance Tuning
JVM Performance TuningJeremy Leisy
 
Writing Plugged-in Java EE Apps: Jason Lee
Writing Plugged-in Java EE Apps: Jason LeeWriting Plugged-in Java EE Apps: Jason Lee
Writing Plugged-in Java EE Apps: Jason Leejaxconf
 
Software Profiling: Java Performance, Profiling and Flamegraphs
Software Profiling: Java Performance, Profiling and FlamegraphsSoftware Profiling: Java Performance, Profiling and Flamegraphs
Software Profiling: Java Performance, Profiling and FlamegraphsIsuru Perera
 
Lessons Learned on Java Tuning for Our Cassandra Clusters (Carlos Monroy, Kne...
Lessons Learned on Java Tuning for Our Cassandra Clusters (Carlos Monroy, Kne...Lessons Learned on Java Tuning for Our Cassandra Clusters (Carlos Monroy, Kne...
Lessons Learned on Java Tuning for Our Cassandra Clusters (Carlos Monroy, Kne...DataStax
 
Extending OpenShift Origin: Build Your Own Cartridge with Bill DeCoste of Red...
Extending OpenShift Origin: Build Your Own Cartridge with Bill DeCoste of Red...Extending OpenShift Origin: Build Your Own Cartridge with Bill DeCoste of Red...
Extending OpenShift Origin: Build Your Own Cartridge with Bill DeCoste of Red...OpenShift Origin
 
Microservices with Micronaut
Microservices with MicronautMicroservices with Micronaut
Microservices with MicronautQAware GmbH
 
Self-service PR-based Terraform
Self-service PR-based TerraformSelf-service PR-based Terraform
Self-service PR-based TerraformAndrew Kirkpatrick
 
Java is Container Ready - Vaibhav - Container Conference 2018
Java is Container Ready - Vaibhav - Container Conference 2018Java is Container Ready - Vaibhav - Container Conference 2018
Java is Container Ready - Vaibhav - Container Conference 2018CodeOps Technologies LLP
 
Clug 2012 March web server optimisation
Clug 2012 March   web server optimisationClug 2012 March   web server optimisation
Clug 2012 March web server optimisationgrooverdan
 
From SQLAlchemy to Ming with TurboGears2
From SQLAlchemy to Ming with TurboGears2From SQLAlchemy to Ming with TurboGears2
From SQLAlchemy to Ming with TurboGears2Alessandro Molina
 
Tomcat from a cluster to the cloud on RP3
Tomcat from a cluster to the cloud on RP3Tomcat from a cluster to the cloud on RP3
Tomcat from a cluster to the cloud on RP3Jean-Frederic Clere
 
Golden Gate - How to start such a project?
Golden Gate  - How to start such a project?Golden Gate  - How to start such a project?
Golden Gate - How to start such a project?Trivadis
 

Ähnlich wie Introduction to Terracotta (20)

Clustering Sakai with Terracotta
Clustering Sakai with TerracottaClustering Sakai with Terracotta
Clustering Sakai with Terracotta
 
Java and Containers - Make it Awesome !
Java and Containers - Make it Awesome !Java and Containers - Make it Awesome !
Java and Containers - Make it Awesome !
 
Lightweight Grids With Terracotta
Lightweight Grids With TerracottaLightweight Grids With Terracotta
Lightweight Grids With Terracotta
 
Ob1k presentation at Java.IL
Ob1k presentation at Java.ILOb1k presentation at Java.IL
Ob1k presentation at Java.IL
 
Terracotta Ch'ti Jug
Terracotta Ch'ti JugTerracotta Ch'ti Jug
Terracotta Ch'ti Jug
 
State of Java Elasticity. Tuning Java Efficiency - GIDS.JAVA LIVE 2020
State of Java Elasticity. Tuning Java Efficiency - GIDS.JAVA LIVE 2020State of Java Elasticity. Tuning Java Efficiency - GIDS.JAVA LIVE 2020
State of Java Elasticity. Tuning Java Efficiency - GIDS.JAVA LIVE 2020
 
JVM Performance Tuning
JVM Performance TuningJVM Performance Tuning
JVM Performance Tuning
 
Writing Plugged-in Java EE Apps: Jason Lee
Writing Plugged-in Java EE Apps: Jason LeeWriting Plugged-in Java EE Apps: Jason Lee
Writing Plugged-in Java EE Apps: Jason Lee
 
Software Profiling: Java Performance, Profiling and Flamegraphs
Software Profiling: Java Performance, Profiling and FlamegraphsSoftware Profiling: Java Performance, Profiling and Flamegraphs
Software Profiling: Java Performance, Profiling and Flamegraphs
 
Terraform training 🎒 - Basic
Terraform training 🎒 - BasicTerraform training 🎒 - Basic
Terraform training 🎒 - Basic
 
Lessons Learned on Java Tuning for Our Cassandra Clusters (Carlos Monroy, Kne...
Lessons Learned on Java Tuning for Our Cassandra Clusters (Carlos Monroy, Kne...Lessons Learned on Java Tuning for Our Cassandra Clusters (Carlos Monroy, Kne...
Lessons Learned on Java Tuning for Our Cassandra Clusters (Carlos Monroy, Kne...
 
Kommons
KommonsKommons
Kommons
 
Extending OpenShift Origin: Build Your Own Cartridge with Bill DeCoste of Red...
Extending OpenShift Origin: Build Your Own Cartridge with Bill DeCoste of Red...Extending OpenShift Origin: Build Your Own Cartridge with Bill DeCoste of Red...
Extending OpenShift Origin: Build Your Own Cartridge with Bill DeCoste of Red...
 
Microservices with Micronaut
Microservices with MicronautMicroservices with Micronaut
Microservices with Micronaut
 
Self-service PR-based Terraform
Self-service PR-based TerraformSelf-service PR-based Terraform
Self-service PR-based Terraform
 
Java is Container Ready - Vaibhav - Container Conference 2018
Java is Container Ready - Vaibhav - Container Conference 2018Java is Container Ready - Vaibhav - Container Conference 2018
Java is Container Ready - Vaibhav - Container Conference 2018
 
Clug 2012 March web server optimisation
Clug 2012 March   web server optimisationClug 2012 March   web server optimisation
Clug 2012 March web server optimisation
 
From SQLAlchemy to Ming with TurboGears2
From SQLAlchemy to Ming with TurboGears2From SQLAlchemy to Ming with TurboGears2
From SQLAlchemy to Ming with TurboGears2
 
Tomcat from a cluster to the cloud on RP3
Tomcat from a cluster to the cloud on RP3Tomcat from a cluster to the cloud on RP3
Tomcat from a cluster to the cloud on RP3
 
Golden Gate - How to start such a project?
Golden Gate  - How to start such a project?Golden Gate  - How to start such a project?
Golden Gate - How to start such a project?
 

Mehr von Cris Holdorph

Programming for Performance
Programming for PerformanceProgramming for Performance
Programming for PerformanceCris Holdorph
 
Introduction to International MyLabs
Introduction to International MyLabsIntroduction to International MyLabs
Introduction to International MyLabsCris Holdorph
 
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 EvilCris Holdorph
 
Clustering Made Easier: Using Terracotta with Hibernate and/or EHCache
Clustering Made Easier: Using Terracotta with Hibernate and/or EHCacheClustering Made Easier: Using Terracotta with Hibernate and/or EHCache
Clustering Made Easier: Using Terracotta with Hibernate and/or EHCacheCris Holdorph
 
Developing JSR 286 Portlets
Developing JSR 286 PortletsDeveloping JSR 286 Portlets
Developing JSR 286 PortletsCris Holdorph
 
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 ProjectCris Holdorph
 
Sakai and IMS LIS Integration
Sakai and IMS LIS IntegrationSakai and IMS LIS Integration
Sakai and IMS LIS IntegrationCris Holdorph
 

Mehr von Cris Holdorph (8)

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
 
Clustering Made Easier: Using Terracotta with Hibernate and/or EHCache
Clustering Made Easier: Using Terracotta with Hibernate and/or EHCacheClustering Made Easier: Using Terracotta with Hibernate and/or EHCache
Clustering Made Easier: Using Terracotta with Hibernate and/or EHCache
 
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
 

Kürzlich hochgeladen

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 FresherRemote DBA Services
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
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...Zilliz
 
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...apidays
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
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, ...apidays
 
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 Takeoffsammart93
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesrafiqahmad00786416
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024The Digital Insurer
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024The Digital Insurer
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...Zilliz
 
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusZilliz
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024The Digital Insurer
 

Kürzlich hochgeladen (20)

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
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
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...
 
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...
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
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, ...
 
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
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source Milvus
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 

Introduction to Terracotta

  • 1. Introduction to Terracotta Cris J. Holdorph Software Architect Unicon, Inc. Sakai Conference Cambridge, MA July 9, 2009 © Copyright Unicon, Inc., 2009. 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. Agenda 1. Introduction 2. Main Parts 3. Terracotta Integration Modules 4. Hello World 5. Lessons Learned using Terracotta 6. Different Uses for Terracotta 7. Resources 2
  • 4. Introduction ● Terracotta is... – A Distributed Cache – A Distributed Session Server – Network Attached Memory ● Terracotta is... – Open Source – Java – Client / Server 4
  • 6. Main Parts ● Terracotta Server – tc-config.xml ● Terracotta Enabled Application – tc-config.xml – JAVA_OPTS ● Terracotta Administration Console 6
  • 7. 7
  • 8. tc-config.xml ● Roots ● Locks ● Instrumented Classes ● Transient Fields – Marking – Resolving 8
  • 9. Configuring Roots in tc-config.xml <roots> <root> <field-name>org.pkg.MyClass.aField</field-name> </root> <root> <field-name>org.pkg.MyClass.field2</field-name> </root> </roots> 9
  • 10. Terracotta Locks ● Four types of locks – write (default) – synchronous-write – read – concurrent (discouraged) ● All changes to a Terracotta managed object must be done in the scope of a lock ● You do not need a lock on the object you are changing ● Locks are the Transactions of Terracotta 10
  • 11. Configuring Locks in tc-config.xml <locks> <autolock auto-synchronized="false"> <method-expression>* org.pkg.MyClass.method(..)</method-expression> <lock-level>write</lock-level> </autolock> <autolock auto-synchronized="false"> <method-expression>* org.pkg.SomeClass$Inny.run(..)</ method-expression> <lock-level>write</lock-level> </autolock> </locks> 11
  • 12. Instrumented Classes ● Each instrumented class can or must configure the following section – class-expression (required) – honor-transient (optional) – on-load (optional) ● Optional instrumented-classes section – exclude (optional) 12
  • 13. Configuring Instrumented Classes in tc-config.xml <instrumented-classes> <include> <class-expression>org.pkg.MyClass</class-expression> <honor-transient>true</honor-transient> <on-load><execute><![CDATA[self.log = org.apache.commons.logging.LogFactory.getLog(org.pkg.MyClass.class); ]]></execute></on-load> </include> <include> <class-expression>org.pkg.YourClass</class-expression> <honor-transient>true</honor-transient> <on-load> <method>resolveTransientFields</method> </on-load> </include> </instrumented-classes> 13
  • 14. Resolving Transient Fields ● Transient Fields may be specified 2 ways – Transient keyword in the Java source file and corresponding property to honor transient keyword in tc-config.xml – Explicitly declaring a field as transient in the tc- config.xml file ● Transient Fields may be resolved in 2 ways – BeanShell script in tc-config.xml – Calling a method on the resolved object 14
  • 15. Resolving a Transient Field with BeanShell <instrumented-classes> <include> <class-expression>org.pkg.MyClass</class-expression> <honor-transient>true</honor-transient> <on-load> <execute><![CDATA[self.log = org.apache.commons.logging.LogFactory.getLog(org.pkg.MyClass.cla ss);]]></execute> </on-load> </include> </instrumented-classes> 15
  • 16. Resolving a Transient Field with Java <instrumented-classes> <include> <class-expression>org.pkg.YourClass</class-expression> <honor-transient>true</honor-transient> <on-load> <method>resolveTransientFields</method> </on-load> </include> </instrumented-classes> 16
  • 18. Terracotta Integration Modules ● TIM (Terracotta Integration Module) – OSGi bundle – Maven artifact ● Use to decompose your tc-config.xml ● Let different application components manage their own tc-config.xml configuration bits ● Maven support for building a TIM 18
  • 19. Using a TIM in tc-config.xml <clients> <logs>/var/logs/terracotta/client/</logs> <statistics>/var/logs/terracotta/clientstats</statistics> <modules> <repository>/opt/local/tc-repo/</repository> <module name="tim-mytim" version="1.2.3" group- id="org.pkg"/> <module name="tim-yourtim" version="2.0.7" group- id="org.pkg"/> </modules> </clients> 19
  • 20. Creating a TIM with Maven <plugins> <plugin> <groupId>org.terracotta.maven.plugins</groupId> <artifactId>tc-maven-plugin</artifactId> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId> </plugin> </plugins> For a complete example look at the following pom.xml file https://source.sakaiproject.org/svn/kernel/trunk/kernel-tim/pom.xml 20
  • 22. Lessons Learned ● Serializable, Transient, Synchronization ● Course Grained Locking versus Fine Grained Locking ● Cluster-wide Locking ● TIMs 22
  • 23. Lessons Learned ● Partitioning your data – Avoiding iterating over all objects in a Root collection ● Minor field updates vs Full object replacements ● Instrumenting ALL classes that access shared objects ● Avoid direct field access (use setters instead) ● Avoid non-static inner classes (they require storage of the outer class) 23
  • 24. Different Uses for Terracotta 24
  • 25. Different Uses for Terracotta ● Clustering your application for server failover – Transparent session migration ● Hibernate second level cache mirroring ● General purpose cache mirroring ● Pseudo Object Database 25
  • 26. Resources 26
  • 27. Resources ● Cluster-enabling Sakai with Terracotta – Tuesday, 10:15 am ● Websites – Open Source http://www.terracotta.org/ – Commercial http://www.terracottatech.com/ ● Website Resources – Downloads – Documentation – Forums ● Book – The Definitive Guide to Terracotta, ISBN-13: 978- 1590599860 27
  • 28. Questions & Answers Cris J. Holdorph Software Architect Unicon, Inc. holdorph@unicon.net www.unicon.net 28