SlideShare a Scribd company logo
1 of 32
Download to read offline
Lightweight Grids with Terracotta
        PT JUG, March 6, 2008


Cesario Ramos
Xebia
www.xebia.com
Goal of this session

• Understand how availabilty and scalability
  issues could be solved using a grid approach
• Understand how you could use Terracotta to
  create a lightweight grid in a simple manner.
Overview

•   Enterprise application challenges
•   How can a grid approach help?
•   Terracotta Overview
•   A simple grid example using Terracotta
•   Q&A
Application challenges

• Availability
   – Measured as the probability of being down.
   – How do you keep your systems up?
      • Important to avoid a Single Point of Failure.
• Scalability
   – Increase in computing power proportionally to
     the capacity added.
   – How do you make your system scalable?
      • Important to avoid Single Point of Bottleneck.
High Availability

•   Take into account that:
     – Redundancy in machinery means that:
         • 1 node: p(down) = .01 (99%)
         • 2 node: p(down) = .01 * .01 = .0001 (99.99%)
     – Adding tiers can decrease availability:
         • Three tiers with 99% uptime each gives .99 * .99 * .99 = 97%
           uptime.
     – Often better to have more ‘small’ then few ‘big’ machines.
         • Eight 1-cpu machines often better then two 4-cpu machines.
         • Node failure increases load on others.
•   Focus on
     – Use buffers to protect tiers (failure)
         • Decouple Tiers (e.g. using JMS)
         • Use caching
High Scalability

• Focus on:
  – Co-location of tiers.
     • Reduce cost of inter tier communication
     • Reduce cost of serialization and remote objects
  – Avoid concurrency control bottlenecks.
     • Isolation levels, application lock contention, …
  – Favor bottleneck in the application tier.
     • CPU, memory bound.
  – Use caching for
     • Fast data access
     • Unloading of expensive tiers
The client/server architecture




• Single Point Of Failure.
• Single Point Of Bottleneck.
Clustering your application
                            • Cluster the
                              servers.
                                – Use Serialization,
           LBR                    RMI, JMS, ...
                            • Keep session
                              state small, max
                              10kb.
                            • Store state in db.
                                – Transient state.

• Unload responsibility to the database
   – Complicated and expensive to cluster.
Summary

• Try to avoid SPOF and SPOB.
• Don’t misuse your EIS for transient data.
  – Eventually it will become a SPOB
• Often better to have more ‘small’ than few
  ‘big’ machines.
• Use caching to unload expensive tiers.
Overview

•   Enterprise application challenges.
•   How can a grid approach help?
•   Terracotta Overview
•   A simple grid example using Terracotta.
•   Q&A.
What is a computational grid?


                             work


              work
                                       work




                                    work
                work



Increased computing power is bounded by its data
                  access speed
What is a data grid?

                           work


                  work
                                     work




                                  work
                   work




• Locality of reference.
Caching topologies

• Partitioned
  –   Partition data across all members
  –   High scalability
  –   Load balanced
  –   Fits nicely on a data grid
• Replicated
  – Replicate data to all members
  – High Performance
  – Limits on data update and entry
Summary

• Availability
   – Use of data duplication
   – Redundancy in machinery and replication of
     components
• Scalability
   – Use of Locality of Reference
   – Move operations around instead of data
   – Dynamic allocation of resources.
• Grid middleware takes care of
   –   Distribution of load, logic, data and events.
   –   Dynamically adopt new nodes
   –   Persistence.
   –   Transactions.
Overview

•   Enterprise application challenges.
•   How can a grid approach help?
•   Terracotta Overview.
•   A grid example using Terracotta.
•   Q&A.
Terracotta in a nutshell?

• Open Source clustering solution for Java
• Availability and scalability at the JVM level
• Allows you to write Java applications for a
  single JVM and have it distributed over
  various JVMs in a transparent way
• Reduces the complexity of distributed
  computing
• Provides a basis for realizing grid solutions
• Runtime monitoring and control
• No API
Terracotta architecture
  Scale-out

   App Server                  App Server                  App Server

              Web App                     Web App                   Web App

    Sessions Objects            Sessions Objects            Sessions Objects

     Any Framework               Any Framework              Any Framework

    Any Java Objects            Any Java Objects            Any Java Objects



          Terracotta Library          Terracotta Library         Terracotta Library
    JVM                         JVM                        JVM




                          Terracotta Server (ACTIVE)
                               Terracotta Server
                                Clustering the JVM



                         Terracotta Server (PASSIVE)
                                Clustering the JVM
How to use the extended heap?
•   Distributed Shared Object.
     – Terracotta instrumented object.
     – Cluster wide unique object.
•   Shared root
        • starting point of a distributed object graph
        • class data member that is transparently mirrored
        • are persisted across JVM lifecycle
•   Terracotta transaction
     – MONITOR ENTRY and MONITOR EXIT
     – Changed data is synchronized using synchronous commit.
•   Locks
     – Cluster wide synchronized, wait/notify
     – Synchronous-Write, Write, Read, Concurrent
     – Named, Auto
What does Terracotta offer?

•   Availability and Scalability
   – Data written to TC is persistent until explicitly removed
   – Redundant TC servers.
   – Fine grained changes. (No serialization)
   – Copy only where resident.
   – Automatic partitioning.
• Dynamic allocation of resources.
• Transparent distribution and partitioning of
   – logic, data or events.
• Transactions.
   – Java memory model semantics
   – Lock acquire and lock release for flushing data to TC.
Simple Example
                                         tc-config.xml
public class Consumer {
                                         …
private LinkedBlockingQueue<Something>
                                         <instrumented-classes>
    queue;
                                          <include>
public void consume() {
                                           <class-expression>
    Something msg = null;
                                             example.Something
    while(true) {
                                           </class-expression>
    msg = queue.take()                   ...
…                                        <root><field-name>
public class Producer {                       example.Consumer.queue
private LinkedBlockingQueue<Something>    </field-name>
    queue;                                <root-name>rootQueue</root-name>
public void produce() {                  </root>
    Something msg = null;                <root>
    while(true) {                         <field-name>Producer.queue</field-name>
    msg = queue.put();                    <root-name>rootQueue</root-name>
…                                        </root>
                                         …
Terracotta use cases

• Grid solutions
  – E.g. using WorkManager spec by IBM & BEA
• Clustering POJOs
• Distributed caching
  – E.g. standalone cache, Hibernate L2
• Clustering Spring
• HTTPSession clustering
  – No serialization, No SetAttribute(…)
Summary

•   Availability and scalability at the JVM level.
•   Keeps JVM semantics across the cluster.
•   Reduces complexity of distributed computing.
•   Provides a basis for realizing grid solutions.
Overview

•   Enterprise application challenges.
•   How can a grid approach help?
•   Terracotta Overview.
•   A simple grid example using Terracotta.
•   Q&A.
Use Case



Parse      TransF   TransF   Write
Input         X        Y     Result




 I                            O
Prometheus

• Library that extends java.util.concurrent.
• Makes it easy to separate business logic
  from concurrent infrastructure logic.
• Offers coarse grained building blocks i.e.
  –   Processor
  –   Process
  –   Repeater
  –   Channel
Fits nicely in Prometheus


Processor

    Parse          Fib         Pi      Write
   Process       Process    Process   Process




                  Channel
      I                                  O
Fibonacci Process

public class FibonacciProcess {
   …
  public void receive(Task task) {
    task.setOutFibonacci(fibonacci(task.getInFibonacci()));
    log.info(task);
  }
  public static long fibonacci(long n) {
    if (n <= 1)
        return n;
    else
        return fibonacci(n - 1) + fibonacci(n - 2);
  }
}
Spring config: tc-config

…
    <application-contexts>
      <application-context>
        <paths>
            <path>applicationcontext-channels.xml</path>
        </paths>
        <beans>
            <bean name=quot;parseToFibquot;/>
            <bean name=“FibToPiquot;/>
            <bean name=“PiToWritequot;/>
        </beans>
      </application-context>
    </application-contexts>
…
Distributed parallelized


Processor      Processor      Processor   Processor

  Parse       Processor
                  Parse      Processor
                                  Fib       Write
             Processor
 Process         Process
                 Parse          Process
                            Processor
                                 Fib       Process
            Processor
               Parse
               Process         Process
                           Processor
                                Fib
               Fib
              Process        Process
                               Pi
             Process
                            Process


   I                                            O
Wrapping up

•   Terracotta turns scalability and high-availability into a
    deployment artifact
•   Keep the simplicity of POJO-based development – get Scale-
    Out with Simplicity
•   Makes mission-critical applications simpler to:
     –   Write
     –   Understand
     –   Maintain
     –   Test
•   Endless possibilities for clustering and distributed programming
    - these were just a few
•   Be creative, use your imagination and have fun…
•   But beware, TC introduces subtle changes:
     – Semantics: tc-roots
     – API’s and behaviour of modules like EHCache
Final Note

• Want to hear more?
  – blogs.xebia.com
  – podcast.xebia.com
     • Interview with Jonas Boner from Terracotta
• Want to learn more about performance?
  – Xebia course on may 2008:
     • Speeding up Java applications of Kirk Pepperdine
• Prometheus
  – http://prometheus.codehaus.org/
Lightweight Grids with Terracotta


         Cesario Ramos
            Xebia

More Related Content

What's hot

Solving_the_C20K_problem_PHP_Performance_and_Scalability-phpquebec_2009
Solving_the_C20K_problem_PHP_Performance_and_Scalability-phpquebec_2009Solving_the_C20K_problem_PHP_Performance_and_Scalability-phpquebec_2009
Solving_the_C20K_problem_PHP_Performance_and_Scalability-phpquebec_2009Hiroshi Ono
 
JVM Garbage Collection Tuning
JVM Garbage Collection TuningJVM Garbage Collection Tuning
JVM Garbage Collection Tuningihji
 
Elephant Roads: a tour of Postgres forks
Elephant Roads: a tour of Postgres forksElephant Roads: a tour of Postgres forks
Elephant Roads: a tour of Postgres forksCommand Prompt., Inc
 
QCon London: Low latency Java in the real world - LMAX Exchange and the Zing JVM
QCon London: Low latency Java in the real world - LMAX Exchange and the Zing JVMQCon London: Low latency Java in the real world - LMAX Exchange and the Zing JVM
QCon London: Low latency Java in the real world - LMAX Exchange and the Zing JVMAzul Systems, Inc.
 
Garbage First and you
Garbage First and youGarbage First and you
Garbage First and youKai Koenig
 
ActiveMQ In Action
ActiveMQ In ActionActiveMQ In Action
ActiveMQ In ActionBruce Snyder
 
Tungsten University: Replicate Between MySQL And Oracle
Tungsten University: Replicate Between MySQL And OracleTungsten University: Replicate Between MySQL And Oracle
Tungsten University: Replicate Between MySQL And OracleContinuent
 
Think Distributed: The Hazelcast Way
Think Distributed: The Hazelcast WayThink Distributed: The Hazelcast Way
Think Distributed: The Hazelcast WayRahul Gupta
 
Hazelcast Essentials
Hazelcast EssentialsHazelcast Essentials
Hazelcast EssentialsRahul Gupta
 
Built-in query caching for all PHP MySQL extensions/APIs
Built-in query caching for all PHP MySQL extensions/APIsBuilt-in query caching for all PHP MySQL extensions/APIs
Built-in query caching for all PHP MySQL extensions/APIsUlf Wendel
 
Memcachedb: The Complete Guide
Memcachedb: The Complete GuideMemcachedb: The Complete Guide
Memcachedb: The Complete Guideelliando dias
 
Tuning Java for Big Data
Tuning Java for Big DataTuning Java for Big Data
Tuning Java for Big DataScott Seighman
 
On heap cache vs off-heap cache
On heap cache vs off-heap cacheOn heap cache vs off-heap cache
On heap cache vs off-heap cachergrebski
 
Cache is King ( Or How To Stop Worrying And Start Caching in Java) at Chicago...
Cache is King ( Or How To Stop Worrying And Start Caching in Java) at Chicago...Cache is King ( Or How To Stop Worrying And Start Caching in Java) at Chicago...
Cache is King ( Or How To Stop Worrying And Start Caching in Java) at Chicago...srisatish ambati
 
App Engine Dev Days DC 20091026
App Engine Dev Days DC 20091026App Engine Dev Days DC 20091026
App Engine Dev Days DC 20091026jblocksom
 
Introduction to hazelcast
Introduction to hazelcastIntroduction to hazelcast
Introduction to hazelcastEmin Demirci
 

What's hot (19)

Solving_the_C20K_problem_PHP_Performance_and_Scalability-phpquebec_2009
Solving_the_C20K_problem_PHP_Performance_and_Scalability-phpquebec_2009Solving_the_C20K_problem_PHP_Performance_and_Scalability-phpquebec_2009
Solving_the_C20K_problem_PHP_Performance_and_Scalability-phpquebec_2009
 
Hazelcast Introduction
Hazelcast IntroductionHazelcast Introduction
Hazelcast Introduction
 
Basics of JVM Tuning
Basics of JVM TuningBasics of JVM Tuning
Basics of JVM Tuning
 
JVM Garbage Collection Tuning
JVM Garbage Collection TuningJVM Garbage Collection Tuning
JVM Garbage Collection Tuning
 
Elephant Roads: a tour of Postgres forks
Elephant Roads: a tour of Postgres forksElephant Roads: a tour of Postgres forks
Elephant Roads: a tour of Postgres forks
 
QCon London: Low latency Java in the real world - LMAX Exchange and the Zing JVM
QCon London: Low latency Java in the real world - LMAX Exchange and the Zing JVMQCon London: Low latency Java in the real world - LMAX Exchange and the Zing JVM
QCon London: Low latency Java in the real world - LMAX Exchange and the Zing JVM
 
Garbage First and you
Garbage First and youGarbage First and you
Garbage First and you
 
ActiveMQ In Action
ActiveMQ In ActionActiveMQ In Action
ActiveMQ In Action
 
Tungsten University: Replicate Between MySQL And Oracle
Tungsten University: Replicate Between MySQL And OracleTungsten University: Replicate Between MySQL And Oracle
Tungsten University: Replicate Between MySQL And Oracle
 
Think Distributed: The Hazelcast Way
Think Distributed: The Hazelcast WayThink Distributed: The Hazelcast Way
Think Distributed: The Hazelcast Way
 
Hazelcast Essentials
Hazelcast EssentialsHazelcast Essentials
Hazelcast Essentials
 
Built-in query caching for all PHP MySQL extensions/APIs
Built-in query caching for all PHP MySQL extensions/APIsBuilt-in query caching for all PHP MySQL extensions/APIs
Built-in query caching for all PHP MySQL extensions/APIs
 
Memcachedb: The Complete Guide
Memcachedb: The Complete GuideMemcachedb: The Complete Guide
Memcachedb: The Complete Guide
 
Java GC, Off-heap workshop
Java GC, Off-heap workshopJava GC, Off-heap workshop
Java GC, Off-heap workshop
 
Tuning Java for Big Data
Tuning Java for Big DataTuning Java for Big Data
Tuning Java for Big Data
 
On heap cache vs off-heap cache
On heap cache vs off-heap cacheOn heap cache vs off-heap cache
On heap cache vs off-heap cache
 
Cache is King ( Or How To Stop Worrying And Start Caching in Java) at Chicago...
Cache is King ( Or How To Stop Worrying And Start Caching in Java) at Chicago...Cache is King ( Or How To Stop Worrying And Start Caching in Java) at Chicago...
Cache is King ( Or How To Stop Worrying And Start Caching in Java) at Chicago...
 
App Engine Dev Days DC 20091026
App Engine Dev Days DC 20091026App Engine Dev Days DC 20091026
App Engine Dev Days DC 20091026
 
Introduction to hazelcast
Introduction to hazelcastIntroduction to hazelcast
Introduction to hazelcast
 

Similar to Lightweight Grids With Terracotta

Breaking The Clustering Limits @ AlphaCSP JavaEdge 2007
Breaking The Clustering Limits @ AlphaCSP JavaEdge 2007Breaking The Clustering Limits @ AlphaCSP JavaEdge 2007
Breaking The Clustering Limits @ AlphaCSP JavaEdge 2007Baruch Sadogursky
 
Brian Oliver Pimp My Data Grid
Brian Oliver  Pimp My Data GridBrian Oliver  Pimp My Data Grid
Brian Oliver Pimp My Data Griddeimos
 
[Roblek] Distributed computing in practice
[Roblek] Distributed computing in practice[Roblek] Distributed computing in practice
[Roblek] Distributed computing in practicejavablend
 
Ari Zilka Cluster Architecture Patterns
Ari Zilka Cluster Architecture PatternsAri Zilka Cluster Architecture Patterns
Ari Zilka Cluster Architecture Patternsdeimos
 
Planning to Fail #phpne13
Planning to Fail #phpne13Planning to Fail #phpne13
Planning to Fail #phpne13Dave Gardner
 
High performace network of Cloud Native Taiwan User Group
High performace network of Cloud Native Taiwan User GroupHigh performace network of Cloud Native Taiwan User Group
High performace network of Cloud Native Taiwan User GroupHungWei Chiu
 
Introduction to Real Time Java
Introduction to Real Time JavaIntroduction to Real Time Java
Introduction to Real Time JavaDeniz Oguz
 
Rails Conf Europe 2007 Notes
Rails Conf  Europe 2007  NotesRails Conf  Europe 2007  Notes
Rails Conf Europe 2007 NotesRoss Lawley
 
Gridify your Spring application with Grid Gain @ Spring Italian Meeting 2008
Gridify your Spring application with Grid Gain @ Spring Italian Meeting 2008Gridify your Spring application with Grid Gain @ Spring Italian Meeting 2008
Gridify your Spring application with Grid Gain @ Spring Italian Meeting 2008Sergio Bossa
 
Building a Database for the End of the World
Building a Database for the End of the WorldBuilding a Database for the End of the World
Building a Database for the End of the Worldjhugg
 
Galera Multi Master Synchronous My S Q L Replication Clusters
Galera  Multi Master  Synchronous  My S Q L  Replication  ClustersGalera  Multi Master  Synchronous  My S Q L  Replication  Clusters
Galera Multi Master Synchronous My S Q L Replication ClustersPerconaPerformance
 
Real-Time Analytics with Kafka, Cassandra and Storm
Real-Time Analytics with Kafka, Cassandra and StormReal-Time Analytics with Kafka, Cassandra and Storm
Real-Time Analytics with Kafka, Cassandra and StormJohn Georgiadis
 
Low latency in java 8 v5
Low latency in java 8 v5Low latency in java 8 v5
Low latency in java 8 v5Peter Lawrey
 
In-Memory Logical Data Warehouse for accelerating Machine Learning Pipelines ...
In-Memory Logical Data Warehouse for accelerating Machine Learning Pipelines ...In-Memory Logical Data Warehouse for accelerating Machine Learning Pipelines ...
In-Memory Logical Data Warehouse for accelerating Machine Learning Pipelines ...Gianmario Spacagna
 
Distributed Caching Essential Lessons (Ts 1402)
Distributed Caching   Essential Lessons (Ts 1402)Distributed Caching   Essential Lessons (Ts 1402)
Distributed Caching Essential Lessons (Ts 1402)Yury Kaliaha
 
The Cloud-natives are RESTless @ JavaOne
The Cloud-natives are RESTless @ JavaOneThe Cloud-natives are RESTless @ JavaOne
The Cloud-natives are RESTless @ JavaOneKonrad Malawski
 
Operating and Supporting Delta Lake in Production
Operating and Supporting Delta Lake in ProductionOperating and Supporting Delta Lake in Production
Operating and Supporting Delta Lake in ProductionDatabricks
 
Data Streaming Technology Overview
Data Streaming Technology OverviewData Streaming Technology Overview
Data Streaming Technology OverviewDan Lynn
 

Similar to Lightweight Grids With Terracotta (20)

Breaking The Clustering Limits @ AlphaCSP JavaEdge 2007
Breaking The Clustering Limits @ AlphaCSP JavaEdge 2007Breaking The Clustering Limits @ AlphaCSP JavaEdge 2007
Breaking The Clustering Limits @ AlphaCSP JavaEdge 2007
 
Brian Oliver Pimp My Data Grid
Brian Oliver  Pimp My Data GridBrian Oliver  Pimp My Data Grid
Brian Oliver Pimp My Data Grid
 
[Roblek] Distributed computing in practice
[Roblek] Distributed computing in practice[Roblek] Distributed computing in practice
[Roblek] Distributed computing in practice
 
EVCache & Moneta (GoSF)
EVCache & Moneta (GoSF)EVCache & Moneta (GoSF)
EVCache & Moneta (GoSF)
 
Clustering van IT-componenten
Clustering van IT-componentenClustering van IT-componenten
Clustering van IT-componenten
 
Ari Zilka Cluster Architecture Patterns
Ari Zilka Cluster Architecture PatternsAri Zilka Cluster Architecture Patterns
Ari Zilka Cluster Architecture Patterns
 
Planning to Fail #phpne13
Planning to Fail #phpne13Planning to Fail #phpne13
Planning to Fail #phpne13
 
High performace network of Cloud Native Taiwan User Group
High performace network of Cloud Native Taiwan User GroupHigh performace network of Cloud Native Taiwan User Group
High performace network of Cloud Native Taiwan User Group
 
Introduction to Real Time Java
Introduction to Real Time JavaIntroduction to Real Time Java
Introduction to Real Time Java
 
Rails Conf Europe 2007 Notes
Rails Conf  Europe 2007  NotesRails Conf  Europe 2007  Notes
Rails Conf Europe 2007 Notes
 
Gridify your Spring application with Grid Gain @ Spring Italian Meeting 2008
Gridify your Spring application with Grid Gain @ Spring Italian Meeting 2008Gridify your Spring application with Grid Gain @ Spring Italian Meeting 2008
Gridify your Spring application with Grid Gain @ Spring Italian Meeting 2008
 
Building a Database for the End of the World
Building a Database for the End of the WorldBuilding a Database for the End of the World
Building a Database for the End of the World
 
Galera Multi Master Synchronous My S Q L Replication Clusters
Galera  Multi Master  Synchronous  My S Q L  Replication  ClustersGalera  Multi Master  Synchronous  My S Q L  Replication  Clusters
Galera Multi Master Synchronous My S Q L Replication Clusters
 
Real-Time Analytics with Kafka, Cassandra and Storm
Real-Time Analytics with Kafka, Cassandra and StormReal-Time Analytics with Kafka, Cassandra and Storm
Real-Time Analytics with Kafka, Cassandra and Storm
 
Low latency in java 8 v5
Low latency in java 8 v5Low latency in java 8 v5
Low latency in java 8 v5
 
In-Memory Logical Data Warehouse for accelerating Machine Learning Pipelines ...
In-Memory Logical Data Warehouse for accelerating Machine Learning Pipelines ...In-Memory Logical Data Warehouse for accelerating Machine Learning Pipelines ...
In-Memory Logical Data Warehouse for accelerating Machine Learning Pipelines ...
 
Distributed Caching Essential Lessons (Ts 1402)
Distributed Caching   Essential Lessons (Ts 1402)Distributed Caching   Essential Lessons (Ts 1402)
Distributed Caching Essential Lessons (Ts 1402)
 
The Cloud-natives are RESTless @ JavaOne
The Cloud-natives are RESTless @ JavaOneThe Cloud-natives are RESTless @ JavaOne
The Cloud-natives are RESTless @ JavaOne
 
Operating and Supporting Delta Lake in Production
Operating and Supporting Delta Lake in ProductionOperating and Supporting Delta Lake in Production
Operating and Supporting Delta Lake in Production
 
Data Streaming Technology Overview
Data Streaming Technology OverviewData Streaming Technology Overview
Data Streaming Technology Overview
 

More from PT.JUG

Overview of Eclipse technologies
Overview of Eclipse technologiesOverview of Eclipse technologies
Overview of Eclipse technologiesPT.JUG
 
Putting Hypermedia Back in REST with JAX-RS
Putting Hypermedia Back in REST with JAX-RSPutting Hypermedia Back in REST with JAX-RS
Putting Hypermedia Back in REST with JAX-RSPT.JUG
 
Microservices
MicroservicesMicroservices
MicroservicesPT.JUG
 
Useful Design Patterns for Enterprise Applications with Java
Useful Design Patterns for Enterprise Applications with JavaUseful Design Patterns for Enterprise Applications with Java
Useful Design Patterns for Enterprise Applications with JavaPT.JUG
 
Flame Graphs, uma (boa) alternativa para profiling de apps Java
Flame Graphs, uma (boa) alternativa para profiling de apps JavaFlame Graphs, uma (boa) alternativa para profiling de apps Java
Flame Graphs, uma (boa) alternativa para profiling de apps JavaPT.JUG
 
What's Coming in Java EE 8
What's Coming in Java EE 8What's Coming in Java EE 8
What's Coming in Java EE 8PT.JUG
 
An Introduction to Play 2 Framework
An Introduction to Play 2 FrameworkAn Introduction to Play 2 Framework
An Introduction to Play 2 FrameworkPT.JUG
 
Introducing Java 8
Introducing Java 8Introducing Java 8
Introducing Java 8PT.JUG
 
JMockit & Hamcrest
JMockit & HamcrestJMockit & Hamcrest
JMockit & HamcrestPT.JUG
 
Apache Camel
Apache CamelApache Camel
Apache CamelPT.JUG
 
Using JPA applications in the era of NoSQL: Introducing Hibernate OGM
Using JPA applications in the era of NoSQL: Introducing Hibernate OGMUsing JPA applications in the era of NoSQL: Introducing Hibernate OGM
Using JPA applications in the era of NoSQL: Introducing Hibernate OGMPT.JUG
 
Introducing Infinispan
Introducing InfinispanIntroducing Infinispan
Introducing InfinispanPT.JUG
 
To SOA or not to SOA
To SOA or not to SOATo SOA or not to SOA
To SOA or not to SOAPT.JUG
 
Introduction to Grails Framework
Introduction to Grails FrameworkIntroduction to Grails Framework
Introduction to Grails FrameworkPT.JUG
 
Apresentação LifeRay
Apresentação LifeRayApresentação LifeRay
Apresentação LifeRayPT.JUG
 
Oracle Java Strategy Lg V3
Oracle Java Strategy Lg V3Oracle Java Strategy Lg V3
Oracle Java Strategy Lg V3PT.JUG
 
Scripting na JVM
Scripting na JVMScripting na JVM
Scripting na JVMPT.JUG
 
The tale of the Fénix architecture
The tale of the Fénix architectureThe tale of the Fénix architecture
The tale of the Fénix architecturePT.JUG
 
Google Web Toolkit
Google Web ToolkitGoogle Web Toolkit
Google Web ToolkitPT.JUG
 

More from PT.JUG (20)

Overview of Eclipse technologies
Overview of Eclipse technologiesOverview of Eclipse technologies
Overview of Eclipse technologies
 
Putting Hypermedia Back in REST with JAX-RS
Putting Hypermedia Back in REST with JAX-RSPutting Hypermedia Back in REST with JAX-RS
Putting Hypermedia Back in REST with JAX-RS
 
Microservices
MicroservicesMicroservices
Microservices
 
Useful Design Patterns for Enterprise Applications with Java
Useful Design Patterns for Enterprise Applications with JavaUseful Design Patterns for Enterprise Applications with Java
Useful Design Patterns for Enterprise Applications with Java
 
Flame Graphs, uma (boa) alternativa para profiling de apps Java
Flame Graphs, uma (boa) alternativa para profiling de apps JavaFlame Graphs, uma (boa) alternativa para profiling de apps Java
Flame Graphs, uma (boa) alternativa para profiling de apps Java
 
What's Coming in Java EE 8
What's Coming in Java EE 8What's Coming in Java EE 8
What's Coming in Java EE 8
 
An Introduction to Play 2 Framework
An Introduction to Play 2 FrameworkAn Introduction to Play 2 Framework
An Introduction to Play 2 Framework
 
MySQL
MySQLMySQL
MySQL
 
Introducing Java 8
Introducing Java 8Introducing Java 8
Introducing Java 8
 
JMockit & Hamcrest
JMockit & HamcrestJMockit & Hamcrest
JMockit & Hamcrest
 
Apache Camel
Apache CamelApache Camel
Apache Camel
 
Using JPA applications in the era of NoSQL: Introducing Hibernate OGM
Using JPA applications in the era of NoSQL: Introducing Hibernate OGMUsing JPA applications in the era of NoSQL: Introducing Hibernate OGM
Using JPA applications in the era of NoSQL: Introducing Hibernate OGM
 
Introducing Infinispan
Introducing InfinispanIntroducing Infinispan
Introducing Infinispan
 
To SOA or not to SOA
To SOA or not to SOATo SOA or not to SOA
To SOA or not to SOA
 
Introduction to Grails Framework
Introduction to Grails FrameworkIntroduction to Grails Framework
Introduction to Grails Framework
 
Apresentação LifeRay
Apresentação LifeRayApresentação LifeRay
Apresentação LifeRay
 
Oracle Java Strategy Lg V3
Oracle Java Strategy Lg V3Oracle Java Strategy Lg V3
Oracle Java Strategy Lg V3
 
Scripting na JVM
Scripting na JVMScripting na JVM
Scripting na JVM
 
The tale of the Fénix architecture
The tale of the Fénix architectureThe tale of the Fénix architecture
The tale of the Fénix architecture
 
Google Web Toolkit
Google Web ToolkitGoogle Web Toolkit
Google Web Toolkit
 

Recently uploaded

Intro to Passkeys and the State of Passwordless.pptx
Intro to Passkeys and the State of Passwordless.pptxIntro to Passkeys and the State of Passwordless.pptx
Intro to Passkeys and the State of Passwordless.pptxFIDO Alliance
 
Easier, Faster, and More Powerful – Notes Document Properties Reimagined
Easier, Faster, and More Powerful – Notes Document Properties ReimaginedEasier, Faster, and More Powerful – Notes Document Properties Reimagined
Easier, Faster, and More Powerful – Notes Document Properties Reimaginedpanagenda
 
ChatGPT and Beyond - Elevating DevOps Productivity
ChatGPT and Beyond - Elevating DevOps ProductivityChatGPT and Beyond - Elevating DevOps Productivity
ChatGPT and Beyond - Elevating DevOps ProductivityVictorSzoltysek
 
Hyatt driving innovation and exceptional customer experiences with FIDO passw...
Hyatt driving innovation and exceptional customer experiences with FIDO passw...Hyatt driving innovation and exceptional customer experiences with FIDO passw...
Hyatt driving innovation and exceptional customer experiences with FIDO passw...FIDO Alliance
 
Human Expert Website Manual WCAG 2.0 2.1 2.2 Audit - Digital Accessibility Au...
Human Expert Website Manual WCAG 2.0 2.1 2.2 Audit - Digital Accessibility Au...Human Expert Website Manual WCAG 2.0 2.1 2.2 Audit - Digital Accessibility Au...
Human Expert Website Manual WCAG 2.0 2.1 2.2 Audit - Digital Accessibility Au...Skynet Technologies
 
Generative AI Use Cases and Applications.pdf
Generative AI Use Cases and Applications.pdfGenerative AI Use Cases and Applications.pdf
Generative AI Use Cases and Applications.pdfalexjohnson7307
 
How to Check CNIC Information Online with Pakdata cf
How to Check CNIC Information Online with Pakdata cfHow to Check CNIC Information Online with Pakdata cf
How to Check CNIC Information Online with Pakdata cfdanishmna97
 
JavaScript Usage Statistics 2024 - The Ultimate Guide
JavaScript Usage Statistics 2024 - The Ultimate GuideJavaScript Usage Statistics 2024 - The Ultimate Guide
JavaScript Usage Statistics 2024 - The Ultimate GuidePixlogix Infotech
 
AI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by AnitarajAI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by AnitarajAnitaRaj43
 
UiPath manufacturing technology benefits and AI overview
UiPath manufacturing technology benefits and AI overviewUiPath manufacturing technology benefits and AI overview
UiPath manufacturing technology benefits and AI overviewDianaGray10
 
Cyber Insurance - RalphGilot - Embry-Riddle Aeronautical University.pptx
Cyber Insurance - RalphGilot - Embry-Riddle Aeronautical University.pptxCyber Insurance - RalphGilot - Embry-Riddle Aeronautical University.pptx
Cyber Insurance - RalphGilot - Embry-Riddle Aeronautical University.pptxMasterG
 
How to Check GPS Location with a Live Tracker in Pakistan
How to Check GPS Location with a Live Tracker in PakistanHow to Check GPS Location with a Live Tracker in Pakistan
How to Check GPS Location with a Live Tracker in Pakistandanishmna97
 
Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...
Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...
Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...ScyllaDB
 
How we scaled to 80K users by doing nothing!.pdf
How we scaled to 80K users by doing nothing!.pdfHow we scaled to 80K users by doing nothing!.pdf
How we scaled to 80K users by doing nothing!.pdfSrushith Repakula
 
Event-Driven Architecture Masterclass: Challenges in Stream Processing
Event-Driven Architecture Masterclass: Challenges in Stream ProcessingEvent-Driven Architecture Masterclass: Challenges in Stream Processing
Event-Driven Architecture Masterclass: Challenges in Stream ProcessingScyllaDB
 
Introduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDMIntroduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDMKumar Satyam
 
Oauth 2.0 Introduction and Flows with MuleSoft
Oauth 2.0 Introduction and Flows with MuleSoftOauth 2.0 Introduction and Flows with MuleSoft
Oauth 2.0 Introduction and Flows with MuleSoftshyamraj55
 
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...panagenda
 
WebRTC and SIP not just audio and video @ OpenSIPS 2024
WebRTC and SIP not just audio and video @ OpenSIPS 2024WebRTC and SIP not just audio and video @ OpenSIPS 2024
WebRTC and SIP not just audio and video @ OpenSIPS 2024Lorenzo Miniero
 
CORS (Kitworks Team Study 양다윗 발표자료 240510)
CORS (Kitworks Team Study 양다윗 발표자료 240510)CORS (Kitworks Team Study 양다윗 발표자료 240510)
CORS (Kitworks Team Study 양다윗 발표자료 240510)Wonjun Hwang
 

Recently uploaded (20)

Intro to Passkeys and the State of Passwordless.pptx
Intro to Passkeys and the State of Passwordless.pptxIntro to Passkeys and the State of Passwordless.pptx
Intro to Passkeys and the State of Passwordless.pptx
 
Easier, Faster, and More Powerful – Notes Document Properties Reimagined
Easier, Faster, and More Powerful – Notes Document Properties ReimaginedEasier, Faster, and More Powerful – Notes Document Properties Reimagined
Easier, Faster, and More Powerful – Notes Document Properties Reimagined
 
ChatGPT and Beyond - Elevating DevOps Productivity
ChatGPT and Beyond - Elevating DevOps ProductivityChatGPT and Beyond - Elevating DevOps Productivity
ChatGPT and Beyond - Elevating DevOps Productivity
 
Hyatt driving innovation and exceptional customer experiences with FIDO passw...
Hyatt driving innovation and exceptional customer experiences with FIDO passw...Hyatt driving innovation and exceptional customer experiences with FIDO passw...
Hyatt driving innovation and exceptional customer experiences with FIDO passw...
 
Human Expert Website Manual WCAG 2.0 2.1 2.2 Audit - Digital Accessibility Au...
Human Expert Website Manual WCAG 2.0 2.1 2.2 Audit - Digital Accessibility Au...Human Expert Website Manual WCAG 2.0 2.1 2.2 Audit - Digital Accessibility Au...
Human Expert Website Manual WCAG 2.0 2.1 2.2 Audit - Digital Accessibility Au...
 
Generative AI Use Cases and Applications.pdf
Generative AI Use Cases and Applications.pdfGenerative AI Use Cases and Applications.pdf
Generative AI Use Cases and Applications.pdf
 
How to Check CNIC Information Online with Pakdata cf
How to Check CNIC Information Online with Pakdata cfHow to Check CNIC Information Online with Pakdata cf
How to Check CNIC Information Online with Pakdata cf
 
JavaScript Usage Statistics 2024 - The Ultimate Guide
JavaScript Usage Statistics 2024 - The Ultimate GuideJavaScript Usage Statistics 2024 - The Ultimate Guide
JavaScript Usage Statistics 2024 - The Ultimate Guide
 
AI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by AnitarajAI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by Anitaraj
 
UiPath manufacturing technology benefits and AI overview
UiPath manufacturing technology benefits and AI overviewUiPath manufacturing technology benefits and AI overview
UiPath manufacturing technology benefits and AI overview
 
Cyber Insurance - RalphGilot - Embry-Riddle Aeronautical University.pptx
Cyber Insurance - RalphGilot - Embry-Riddle Aeronautical University.pptxCyber Insurance - RalphGilot - Embry-Riddle Aeronautical University.pptx
Cyber Insurance - RalphGilot - Embry-Riddle Aeronautical University.pptx
 
How to Check GPS Location with a Live Tracker in Pakistan
How to Check GPS Location with a Live Tracker in PakistanHow to Check GPS Location with a Live Tracker in Pakistan
How to Check GPS Location with a Live Tracker in Pakistan
 
Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...
Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...
Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...
 
How we scaled to 80K users by doing nothing!.pdf
How we scaled to 80K users by doing nothing!.pdfHow we scaled to 80K users by doing nothing!.pdf
How we scaled to 80K users by doing nothing!.pdf
 
Event-Driven Architecture Masterclass: Challenges in Stream Processing
Event-Driven Architecture Masterclass: Challenges in Stream ProcessingEvent-Driven Architecture Masterclass: Challenges in Stream Processing
Event-Driven Architecture Masterclass: Challenges in Stream Processing
 
Introduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDMIntroduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDM
 
Oauth 2.0 Introduction and Flows with MuleSoft
Oauth 2.0 Introduction and Flows with MuleSoftOauth 2.0 Introduction and Flows with MuleSoft
Oauth 2.0 Introduction and Flows with MuleSoft
 
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
 
WebRTC and SIP not just audio and video @ OpenSIPS 2024
WebRTC and SIP not just audio and video @ OpenSIPS 2024WebRTC and SIP not just audio and video @ OpenSIPS 2024
WebRTC and SIP not just audio and video @ OpenSIPS 2024
 
CORS (Kitworks Team Study 양다윗 발표자료 240510)
CORS (Kitworks Team Study 양다윗 발표자료 240510)CORS (Kitworks Team Study 양다윗 발표자료 240510)
CORS (Kitworks Team Study 양다윗 발표자료 240510)
 

Lightweight Grids With Terracotta

  • 1. Lightweight Grids with Terracotta PT JUG, March 6, 2008 Cesario Ramos Xebia www.xebia.com
  • 2. Goal of this session • Understand how availabilty and scalability issues could be solved using a grid approach • Understand how you could use Terracotta to create a lightweight grid in a simple manner.
  • 3. Overview • Enterprise application challenges • How can a grid approach help? • Terracotta Overview • A simple grid example using Terracotta • Q&A
  • 4. Application challenges • Availability – Measured as the probability of being down. – How do you keep your systems up? • Important to avoid a Single Point of Failure. • Scalability – Increase in computing power proportionally to the capacity added. – How do you make your system scalable? • Important to avoid Single Point of Bottleneck.
  • 5. High Availability • Take into account that: – Redundancy in machinery means that: • 1 node: p(down) = .01 (99%) • 2 node: p(down) = .01 * .01 = .0001 (99.99%) – Adding tiers can decrease availability: • Three tiers with 99% uptime each gives .99 * .99 * .99 = 97% uptime. – Often better to have more ‘small’ then few ‘big’ machines. • Eight 1-cpu machines often better then two 4-cpu machines. • Node failure increases load on others. • Focus on – Use buffers to protect tiers (failure) • Decouple Tiers (e.g. using JMS) • Use caching
  • 6. High Scalability • Focus on: – Co-location of tiers. • Reduce cost of inter tier communication • Reduce cost of serialization and remote objects – Avoid concurrency control bottlenecks. • Isolation levels, application lock contention, … – Favor bottleneck in the application tier. • CPU, memory bound. – Use caching for • Fast data access • Unloading of expensive tiers
  • 7. The client/server architecture • Single Point Of Failure. • Single Point Of Bottleneck.
  • 8. Clustering your application • Cluster the servers. – Use Serialization, LBR RMI, JMS, ... • Keep session state small, max 10kb. • Store state in db. – Transient state. • Unload responsibility to the database – Complicated and expensive to cluster.
  • 9. Summary • Try to avoid SPOF and SPOB. • Don’t misuse your EIS for transient data. – Eventually it will become a SPOB • Often better to have more ‘small’ than few ‘big’ machines. • Use caching to unload expensive tiers.
  • 10. Overview • Enterprise application challenges. • How can a grid approach help? • Terracotta Overview • A simple grid example using Terracotta. • Q&A.
  • 11. What is a computational grid? work work work work work Increased computing power is bounded by its data access speed
  • 12. What is a data grid? work work work work work • Locality of reference.
  • 13. Caching topologies • Partitioned – Partition data across all members – High scalability – Load balanced – Fits nicely on a data grid • Replicated – Replicate data to all members – High Performance – Limits on data update and entry
  • 14. Summary • Availability – Use of data duplication – Redundancy in machinery and replication of components • Scalability – Use of Locality of Reference – Move operations around instead of data – Dynamic allocation of resources. • Grid middleware takes care of – Distribution of load, logic, data and events. – Dynamically adopt new nodes – Persistence. – Transactions.
  • 15. Overview • Enterprise application challenges. • How can a grid approach help? • Terracotta Overview. • A grid example using Terracotta. • Q&A.
  • 16. Terracotta in a nutshell? • Open Source clustering solution for Java • Availability and scalability at the JVM level • Allows you to write Java applications for a single JVM and have it distributed over various JVMs in a transparent way • Reduces the complexity of distributed computing • Provides a basis for realizing grid solutions • Runtime monitoring and control • No API
  • 17. Terracotta architecture Scale-out App Server App Server App Server Web App Web App Web App Sessions Objects Sessions Objects Sessions Objects Any Framework Any Framework Any Framework Any Java Objects Any Java Objects Any Java Objects Terracotta Library Terracotta Library Terracotta Library JVM JVM JVM Terracotta Server (ACTIVE) Terracotta Server Clustering the JVM Terracotta Server (PASSIVE) Clustering the JVM
  • 18. How to use the extended heap? • Distributed Shared Object. – Terracotta instrumented object. – Cluster wide unique object. • Shared root • starting point of a distributed object graph • class data member that is transparently mirrored • are persisted across JVM lifecycle • Terracotta transaction – MONITOR ENTRY and MONITOR EXIT – Changed data is synchronized using synchronous commit. • Locks – Cluster wide synchronized, wait/notify – Synchronous-Write, Write, Read, Concurrent – Named, Auto
  • 19. What does Terracotta offer? • Availability and Scalability – Data written to TC is persistent until explicitly removed – Redundant TC servers. – Fine grained changes. (No serialization) – Copy only where resident. – Automatic partitioning. • Dynamic allocation of resources. • Transparent distribution and partitioning of – logic, data or events. • Transactions. – Java memory model semantics – Lock acquire and lock release for flushing data to TC.
  • 20. Simple Example tc-config.xml public class Consumer { … private LinkedBlockingQueue<Something> <instrumented-classes> queue; <include> public void consume() { <class-expression> Something msg = null; example.Something while(true) { </class-expression> msg = queue.take() ... … <root><field-name> public class Producer { example.Consumer.queue private LinkedBlockingQueue<Something> </field-name> queue; <root-name>rootQueue</root-name> public void produce() { </root> Something msg = null; <root> while(true) { <field-name>Producer.queue</field-name> msg = queue.put(); <root-name>rootQueue</root-name> … </root> …
  • 21. Terracotta use cases • Grid solutions – E.g. using WorkManager spec by IBM & BEA • Clustering POJOs • Distributed caching – E.g. standalone cache, Hibernate L2 • Clustering Spring • HTTPSession clustering – No serialization, No SetAttribute(…)
  • 22. Summary • Availability and scalability at the JVM level. • Keeps JVM semantics across the cluster. • Reduces complexity of distributed computing. • Provides a basis for realizing grid solutions.
  • 23. Overview • Enterprise application challenges. • How can a grid approach help? • Terracotta Overview. • A simple grid example using Terracotta. • Q&A.
  • 24. Use Case Parse TransF TransF Write Input X Y Result I O
  • 25. Prometheus • Library that extends java.util.concurrent. • Makes it easy to separate business logic from concurrent infrastructure logic. • Offers coarse grained building blocks i.e. – Processor – Process – Repeater – Channel
  • 26. Fits nicely in Prometheus Processor Parse Fib Pi Write Process Process Process Process Channel I O
  • 27. Fibonacci Process public class FibonacciProcess { … public void receive(Task task) { task.setOutFibonacci(fibonacci(task.getInFibonacci())); log.info(task); } public static long fibonacci(long n) { if (n <= 1) return n; else return fibonacci(n - 1) + fibonacci(n - 2); } }
  • 28. Spring config: tc-config … <application-contexts> <application-context> <paths> <path>applicationcontext-channels.xml</path> </paths> <beans> <bean name=quot;parseToFibquot;/> <bean name=“FibToPiquot;/> <bean name=“PiToWritequot;/> </beans> </application-context> </application-contexts> …
  • 29. Distributed parallelized Processor Processor Processor Processor Parse Processor Parse Processor Fib Write Processor Process Process Parse Process Processor Fib Process Processor Parse Process Process Processor Fib Fib Process Process Pi Process Process I O
  • 30. Wrapping up • Terracotta turns scalability and high-availability into a deployment artifact • Keep the simplicity of POJO-based development – get Scale- Out with Simplicity • Makes mission-critical applications simpler to: – Write – Understand – Maintain – Test • Endless possibilities for clustering and distributed programming - these were just a few • Be creative, use your imagination and have fun… • But beware, TC introduces subtle changes: – Semantics: tc-roots – API’s and behaviour of modules like EHCache
  • 31. Final Note • Want to hear more? – blogs.xebia.com – podcast.xebia.com • Interview with Jonas Boner from Terracotta • Want to learn more about performance? – Xebia course on may 2008: • Speeding up Java applications of Kirk Pepperdine • Prometheus – http://prometheus.codehaus.org/
  • 32. Lightweight Grids with Terracotta Cesario Ramos Xebia