SlideShare a Scribd company logo
1 of 32
Cluster-Enabling Sakai
               with 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. Why Terracotta?
2. Current Status
3. Design and Development
4. Running Terracotta-Enabled Sakai
5. Terracotta-Cluster Enabling a Tool
6. Demo
7. Resources
                                        2
Why Terracotta?




                  3
Why Terracotta
●
    Clustering / Session Failover problem
●
    What options were explored?
    –   Container Managed Sessions
    –   Shared Session Server
         ●
             Ehcache
         ●
             Database
    –   REST style (no session data) web architecture
●
    What problems were uncovered?
    –   Custom Classloaders
    –   Performance
                                                        4
    –   Serializable Objects
Enter Terracotta
●
    Semi-shared Session Server
    –   Don't share everything
●
    Reduced Communication Between Nodes
    –   “Partitioned Data” feature of Terracotta
●
    Less Invasive Sakai Changes
    –   Not every object in Terracotta has to be
        Serializable
    –   Many changes can be done in a Terracotta
        configuration file (tc-config.xml)
●
    Provides a Custom Classloader Solution
                                                   5
Current Status




                 6
Current Status
●
    John Wiley & Sons sponsored Unicon to
    develop Terracotta integration with Sakai
●
    Documentation is in Sakai Confluence
●
    Original Work done as a feature branch
    against Sakai 2.5.x, ported forward to 2.6.x
●
    Migrated into Sakai Trunk / Kernel Trunk
    –   This will be Sakai 2.7.x / Kernel 1.1.x if released
●
    Feature branch (only) contains 2 cluster
    enabled tools
    –   Custom Worksite Setup
                                                              7
    –   Resources / Citations
Design and Development




                         8
Component Manager
●
    Create Custom Classloader
●
    Detecting “sakai.cluster.terracotta” System
    Property
●
    Using Custom Classloader if property is set




                                                  9
Code sample
https://source.sakaiproject.org/svn/kernel/trunk/component-manager/src/
main/java/org/sakaiproject/util/TerracottaClassLoader.java


  ...
  class TerracottaClassLoader extends URLClassLoader {
        private String classLoaderName;
        public TerracottaClassLoader(URL[] urls, ClassLoader
  parent, String classLoaderName) { ... }
      public String __tc_getClassLoaderName() {
            return classLoaderName;
      }
  ...
  }

                                                                  10
SessionManager
●
    Make m_sessions a Terracotta Root
●
    Make MySession and MyLittleSession top level
    classes
    –   Did not want Outer class, SessionManager,
        brought into the Terracotta cluster




                                                    11
Partial Session Sharing
●
    Not all data will be shared
●
    Original Idea, catch NonPortableException
    –   Did not work
●
    New Idea, Tool whitelist
    –   Only tools in the whitelist will be shared
    –   Tools not in the whitelist will not be shared
●
    Final solution, enables gradually enabling
    clustering on a tool-by-tool basis
●
    Even if a tool supports clustering, a system
    administrator can turn clustering off for that
    tool                                         12
Session Maintenance
●
    SessionManager class has an inner
    class/thread called Maintenance
    –   Responsible for removing expired sessions
●
    Need to make sure this behavior still works
●
    Need to make sure this thread/class does not
    violate the Terracotta “Partitioned Data”
    principle
●
    Solution: Create a parallel data structure to
    loosely track session timeout times along with
    session identifiers
                                                    13
UsageSession
●
    UsageSession tracks which user is on which
    server
●
    UsageSession is both a JVM object and
    database record
●
    Need to detect when a user has failed over to
    a new server and update the users
    UsageSession object and database record




                                              14
RequestFilter
●
    Terracotta requires a lock (transaction) be
    obtained to change any data in the cluster
●
    Original design tried to automatically lock any
    clustered object before changing data on that
    object
●
    New design uses a Course Grained lock on
    the Session object, obtained and released in
    the Sakai RequstFilter



                                                  15
Unit Tests
●
    Unit Tests for Component Manager before
    Component Manager changes were made
●
    Unit Tests for Session Manager before Session
    Manager changes were made




                                              16
Session Logging
●
    Code was added to Session Manager to
    enable logging of which tools put which
    objects into a Sakai Session
●
    This helps identify
    –   Heavy users of the Session
    –   Relative size of a Session
    –   Which tools are more self referencing
    –   Which tools tend to reference many other
        tools/components


                                                   17
Worksite Setup
●
    Customized Worksite Setup Tool for John
    Wiley & Sons
●
    Multi-page wizard
●
    Old Sakai / Velocity based tool
●
    Lots of inner classes
●
    Feature branch – Terracotta cluster enabled




                                                  18
Resources / Citations
●
    Provide a vanilla Sakai tool to demonstrate
    Terracotta clusterability
●
    Citation List creation can be a multi-page
    wizard style interaction
●
    Feature branch – Terracotta cluster enabled




                                                  19
Running a Terracotta-
   Enabled Sakai




                        20
Building
●
    Must compile and build the terracotta-config
    module
●
    Must run maven with a special flag
mvn -Dterracotta.enable=true clean install




                                               21
Running
●
    Starting Terracotta Server
    –   tc-config.xml file
    –   Creating the TIM repository
●
    JAVA_OPTS for Sakai / Tomcat
    –   -Dsakai.cluster.terracotta=true -Dtc.install-root=$
        {TC_HOME} -Xbootclasspath/p:${TC_HOME}/lib/
        dso-boot/dso-boot-hotspot_linux_150_14.jar
        -Dtc.config=127.0.0.1:9510
    –   tc-config.xml file



                                                        22
Administration
●
    Terracotta Administration Console
●
    Shutting down Sakai / Tomcat
●
    Shutting down Terracotta Server
●
    Clearing out the Terracotta Object
    “repository”




                                         23
Terracotta-Cluster Enabling a
          Sakai Tool




                            24
Terracotta Enabling a Tool
●
    Add the tool to the clusterableTools property
●
    Create a new TIM (Terracotta Integration
    Module) for the tool
●
    Modify the terracotta-config module to know
    about the new TIM that was created




                                                25
Creating a TIM
●
    Classes for instrumentation
    –   Any class that will be stored in Terracotta
    –   Any class that will modify a class stored in
        Terracotta
●
    Determine transient fields for any classes that
    will be stored in Terracotta
●
    Create a mechanism for resolving transient
    fields
    –   Beanshell
    –   Java method
●
    Promote inner classes to top level classes         26
Code sample
https://source.sakaiproject.org/svn/msub/unicon.net/content/branches/ses
sion-clustering-2-5-x/content-tim/src/main/resources/terracotta.xml


  <?xml version="1.0" encoding="UTF-8" ?>
  <xml-fragment>
         <instrumented-classes>
          <include>
                <class-
  expression>org.sakaiproject.content.types.FolderType$*</c
  lass-expression>
             <honor-transient>true</honor-transient>
          </include>
          <include>
  ...
                                                                   27
Gotchas
●
    Direct field access
    –   Prefer setters
●
    Inner classes
    –   If the outer class is not going to be stored in
        Terracotta, the inner class must be static, however
        this does not prevent the outer class from direct
        field access (see above)
●
    Additional Java classes
●
    Reference classes from another component /
    service

                                                        28
Resources




            29
Resources (1)
●
    Introduction to Terracotta
     –   Monday, 11:30 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
                                                             30
Resources (2)
●
    Sakai Confluence Terracotta link
http://confluence.sakaiproject.org/confluence/display/TERRA/Home



●
    Feature Branch subversion link
https://source.sakaiproject.org/svn/msub/unicon.net/distros/branches/session-clustering-2-5-x/




                                                                                       31
Questions & Answers




          Cris J. Holdorph
          Software Architect
          Unicon, Inc.

          holdorph@unicon.net
          www.unicon.net



                                32

More Related Content

Similar to Clustering Sakai with Terracotta

Clustering In The Wild
Clustering In The WildClustering In The Wild
Clustering In The Wild
Sergio Bossa
 
Hashicorp-Terraform-Deep-Dive-with-no-Fear-Victor-Turbinsky-Texuna.pdf
Hashicorp-Terraform-Deep-Dive-with-no-Fear-Victor-Turbinsky-Texuna.pdfHashicorp-Terraform-Deep-Dive-with-no-Fear-Victor-Turbinsky-Texuna.pdf
Hashicorp-Terraform-Deep-Dive-with-no-Fear-Victor-Turbinsky-Texuna.pdf
ssuser705051
 

Similar to Clustering Sakai with Terracotta (20)

Introduction to Terracotta
Introduction to TerracottaIntroduction to Terracotta
Introduction to Terracotta
 
Clustering In The Wild
Clustering In The WildClustering In The Wild
Clustering In The Wild
 
Gestión de infraestructura tomcat tom ee con tfactory
Gestión de infraestructura tomcat tom ee con tfactoryGestión de infraestructura tomcat tom ee con tfactory
Gestión de infraestructura tomcat tom ee con tfactory
 
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
 
Self-service PR-based Terraform
Self-service PR-based TerraformSelf-service PR-based Terraform
Self-service PR-based Terraform
 
Gestión de infraestructura tomcat/Tom EE con tfactory
Gestión de infraestructura tomcat/Tom EE con tfactoryGestión de infraestructura tomcat/Tom EE con tfactory
Gestión de infraestructura tomcat/Tom EE con tfactory
 
Performance Tuning - Memory leaks, Thread deadlocks, JDK tools
Performance Tuning -  Memory leaks, Thread deadlocks, JDK toolsPerformance Tuning -  Memory leaks, Thread deadlocks, JDK tools
Performance Tuning - Memory leaks, Thread deadlocks, JDK tools
 
Hashicorp-Terraform-Deep-Dive-with-no-Fear-Victor-Turbinsky-Texuna.pdf
Hashicorp-Terraform-Deep-Dive-with-no-Fear-Victor-Turbinsky-Texuna.pdfHashicorp-Terraform-Deep-Dive-with-no-Fear-Victor-Turbinsky-Texuna.pdf
Hashicorp-Terraform-Deep-Dive-with-no-Fear-Victor-Turbinsky-Texuna.pdf
 
Terraform-2.pdf
Terraform-2.pdfTerraform-2.pdf
Terraform-2.pdf
 
Oracle exalytics deployment for high availability
Oracle exalytics deployment for high availabilityOracle exalytics deployment for high availability
Oracle exalytics deployment for high availability
 
Java Cloud and Container Ready
Java Cloud and Container ReadyJava Cloud and Container Ready
Java Cloud and Container Ready
 
Ippevent : openshift Introduction
Ippevent : openshift IntroductionIppevent : openshift Introduction
Ippevent : openshift Introduction
 
Building High Scalability Apps With Terracotta
Building High Scalability Apps With TerracottaBuilding High Scalability Apps With Terracotta
Building High Scalability Apps With Terracotta
 
OCDET Activity and Glusterfs
OCDET Activity and GlusterfsOCDET Activity and Glusterfs
OCDET Activity and Glusterfs
 
Collaborative Terraform with Atlantis
Collaborative Terraform with AtlantisCollaborative Terraform with Atlantis
Collaborative Terraform with Atlantis
 
OpenStack London Meetup, 18 Nov 2015
OpenStack London Meetup, 18 Nov 2015OpenStack London Meetup, 18 Nov 2015
OpenStack London Meetup, 18 Nov 2015
 
Apache cassandra v4.0
Apache cassandra v4.0Apache cassandra v4.0
Apache cassandra v4.0
 
NetflixOSS Open House Lightning talks
NetflixOSS Open House Lightning talksNetflixOSS Open House Lightning talks
NetflixOSS Open House Lightning talks
 
Benchmarking Solr Performance
Benchmarking Solr PerformanceBenchmarking Solr Performance
Benchmarking Solr Performance
 
Containers in depth – Understanding how containers work to better work with c...
Containers in depth – Understanding how containers work to better work with c...Containers in depth – Understanding how containers work to better work with c...
Containers in depth – Understanding how containers work to better work with c...
 

More from Cris Holdorph

More from Cris Holdorph (7)

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
 

Recently uploaded

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
Earley Information Science
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
Enterprise Knowledge
 

Recently uploaded (20)

Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
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
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
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
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 

Clustering Sakai with Terracotta

  • 1. Cluster-Enabling Sakai with 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. Why Terracotta? 2. Current Status 3. Design and Development 4. Running Terracotta-Enabled Sakai 5. Terracotta-Cluster Enabling a Tool 6. Demo 7. Resources 2
  • 4. Why Terracotta ● Clustering / Session Failover problem ● What options were explored? – Container Managed Sessions – Shared Session Server ● Ehcache ● Database – REST style (no session data) web architecture ● What problems were uncovered? – Custom Classloaders – Performance 4 – Serializable Objects
  • 5. Enter Terracotta ● Semi-shared Session Server – Don't share everything ● Reduced Communication Between Nodes – “Partitioned Data” feature of Terracotta ● Less Invasive Sakai Changes – Not every object in Terracotta has to be Serializable – Many changes can be done in a Terracotta configuration file (tc-config.xml) ● Provides a Custom Classloader Solution 5
  • 7. Current Status ● John Wiley & Sons sponsored Unicon to develop Terracotta integration with Sakai ● Documentation is in Sakai Confluence ● Original Work done as a feature branch against Sakai 2.5.x, ported forward to 2.6.x ● Migrated into Sakai Trunk / Kernel Trunk – This will be Sakai 2.7.x / Kernel 1.1.x if released ● Feature branch (only) contains 2 cluster enabled tools – Custom Worksite Setup 7 – Resources / Citations
  • 9. Component Manager ● Create Custom Classloader ● Detecting “sakai.cluster.terracotta” System Property ● Using Custom Classloader if property is set 9
  • 10. Code sample https://source.sakaiproject.org/svn/kernel/trunk/component-manager/src/ main/java/org/sakaiproject/util/TerracottaClassLoader.java ... class TerracottaClassLoader extends URLClassLoader { private String classLoaderName; public TerracottaClassLoader(URL[] urls, ClassLoader parent, String classLoaderName) { ... } public String __tc_getClassLoaderName() { return classLoaderName; } ... } 10
  • 11. SessionManager ● Make m_sessions a Terracotta Root ● Make MySession and MyLittleSession top level classes – Did not want Outer class, SessionManager, brought into the Terracotta cluster 11
  • 12. Partial Session Sharing ● Not all data will be shared ● Original Idea, catch NonPortableException – Did not work ● New Idea, Tool whitelist – Only tools in the whitelist will be shared – Tools not in the whitelist will not be shared ● Final solution, enables gradually enabling clustering on a tool-by-tool basis ● Even if a tool supports clustering, a system administrator can turn clustering off for that tool 12
  • 13. Session Maintenance ● SessionManager class has an inner class/thread called Maintenance – Responsible for removing expired sessions ● Need to make sure this behavior still works ● Need to make sure this thread/class does not violate the Terracotta “Partitioned Data” principle ● Solution: Create a parallel data structure to loosely track session timeout times along with session identifiers 13
  • 14. UsageSession ● UsageSession tracks which user is on which server ● UsageSession is both a JVM object and database record ● Need to detect when a user has failed over to a new server and update the users UsageSession object and database record 14
  • 15. RequestFilter ● Terracotta requires a lock (transaction) be obtained to change any data in the cluster ● Original design tried to automatically lock any clustered object before changing data on that object ● New design uses a Course Grained lock on the Session object, obtained and released in the Sakai RequstFilter 15
  • 16. Unit Tests ● Unit Tests for Component Manager before Component Manager changes were made ● Unit Tests for Session Manager before Session Manager changes were made 16
  • 17. Session Logging ● Code was added to Session Manager to enable logging of which tools put which objects into a Sakai Session ● This helps identify – Heavy users of the Session – Relative size of a Session – Which tools are more self referencing – Which tools tend to reference many other tools/components 17
  • 18. Worksite Setup ● Customized Worksite Setup Tool for John Wiley & Sons ● Multi-page wizard ● Old Sakai / Velocity based tool ● Lots of inner classes ● Feature branch – Terracotta cluster enabled 18
  • 19. Resources / Citations ● Provide a vanilla Sakai tool to demonstrate Terracotta clusterability ● Citation List creation can be a multi-page wizard style interaction ● Feature branch – Terracotta cluster enabled 19
  • 20. Running a Terracotta- Enabled Sakai 20
  • 21. Building ● Must compile and build the terracotta-config module ● Must run maven with a special flag mvn -Dterracotta.enable=true clean install 21
  • 22. Running ● Starting Terracotta Server – tc-config.xml file – Creating the TIM repository ● JAVA_OPTS for Sakai / Tomcat – -Dsakai.cluster.terracotta=true -Dtc.install-root=$ {TC_HOME} -Xbootclasspath/p:${TC_HOME}/lib/ dso-boot/dso-boot-hotspot_linux_150_14.jar -Dtc.config=127.0.0.1:9510 – tc-config.xml file 22
  • 23. Administration ● Terracotta Administration Console ● Shutting down Sakai / Tomcat ● Shutting down Terracotta Server ● Clearing out the Terracotta Object “repository” 23
  • 25. Terracotta Enabling a Tool ● Add the tool to the clusterableTools property ● Create a new TIM (Terracotta Integration Module) for the tool ● Modify the terracotta-config module to know about the new TIM that was created 25
  • 26. Creating a TIM ● Classes for instrumentation – Any class that will be stored in Terracotta – Any class that will modify a class stored in Terracotta ● Determine transient fields for any classes that will be stored in Terracotta ● Create a mechanism for resolving transient fields – Beanshell – Java method ● Promote inner classes to top level classes 26
  • 27. Code sample https://source.sakaiproject.org/svn/msub/unicon.net/content/branches/ses sion-clustering-2-5-x/content-tim/src/main/resources/terracotta.xml <?xml version="1.0" encoding="UTF-8" ?> <xml-fragment> <instrumented-classes> <include> <class- expression>org.sakaiproject.content.types.FolderType$*</c lass-expression> <honor-transient>true</honor-transient> </include> <include> ... 27
  • 28. Gotchas ● Direct field access – Prefer setters ● Inner classes – If the outer class is not going to be stored in Terracotta, the inner class must be static, however this does not prevent the outer class from direct field access (see above) ● Additional Java classes ● Reference classes from another component / service 28
  • 29. Resources 29
  • 30. Resources (1) ● Introduction to Terracotta – Monday, 11:30 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 30
  • 31. Resources (2) ● Sakai Confluence Terracotta link http://confluence.sakaiproject.org/confluence/display/TERRA/Home ● Feature Branch subversion link https://source.sakaiproject.org/svn/msub/unicon.net/distros/branches/session-clustering-2-5-x/ 31
  • 32. Questions & Answers Cris J. Holdorph Software Architect Unicon, Inc. holdorph@unicon.net www.unicon.net 32