0
Scaling Hibernate with
      Terracotta
          Taylor Gautier
    Code Camp, October 3, 2009
Agenda
Agenda

• Caching 101
Agenda

• Caching 101
• Intro to Terracotta
Agenda

• Caching 101
• Intro to Terracotta
• Installation and Setup
Agenda

• Caching 101
• Intro to Terracotta
• Installation and Setup
• Demo
About me...
About me...

•   Java enthusiast since 1996
About me...

•   Java enthusiast since 1996

•   Have built scalable systems since 1999
About me...

•   Java enthusiast since 1996

•   Have built scalable systems since 1999

•   Terracotta Product Manager 20...
About me...

•   Java enthusiast since 1996

•   Have built scalable systems since 1999

•   Terracotta Product Manager 20...
About me...

•   Java enthusiast since 1996

•   Have built scalable systems since 1999

•   Terracotta Product Manager 20...
About me...

•   Java enthusiast since 1996

•   Have built scalable systems since 1999

•   Terracotta Product Manager 20...
Quick poll...
• How many have heard of Terracotta?
• How many have heard of Terracotta?
• How many have downloaded it?
• How many have heard of Terracotta?
• How many have downloaded it?
• Anyone running in production?
Why are you here?
Your app needs...
   something
Your app needs...
  better latency
Your app needs...
better throughput
Your app needs...
 better efficiency
Your app needs...
   to cost less
Let’s see if modern
system architecture can
        help us...
Memory Hierarchy
Why a hierarchy?
Modern Hardware
Modern Hardware
CPU Speed (2GHZ)
1 nanosecond (1x10 -9)
Modern Hardware
 CPU Speed (2GHZ)
 1 nanosecond (1x10 -9)

L1 Cache Access Time
 2 nanoseconds (2x10 -9)
Modern Hardware
 CPU Speed (2GHZ)
 1 nanosecond (1x10 -9)

L1 Cache Access Time
 2 nanoseconds (2x10 -9)

L2 Cache Access ...
Modern Hardware
   CPU Speed (2GHZ)
   1 nanosecond (1x10 -9)

  L1 Cache Access Time
   2 nanoseconds (2x10 -9)

  L2 Cac...
How common is this?




     Modern Hardware
How common is this?




      File-system
How common is this?




     Web Architecture
But not JEE?
But not JEE?

   Hibernate (Session)
But not JEE?

      Hibernate (Session)



 Hibernate Second Level Cache
Hibernate Architecture




      CPU Architecture
Hibernate Architecture


CPU Architecture




                    Hibernate
                   Architecture
How to add a second
 level cache to your
     application?
Terracotta!
What is Terracotta?
IS IT...
A proprietary JVM?
Proprietary software?
Expensive?
Of course not!
Terracotta, is...
Terracotta, is...
Open source
Terracotta, is...
Open source

High Performance Availability
and Scalability
Terracotta, is...
Open source

High Performance Availability
and Scalability

For J2SE & J2EE
Terracotta, is...
Open source

High Performance Availability
and Scalability

For J2SE & J2EE

Really fun!
Terracotta Platform




  Terracotta Platform (Server Array)
Terracotta Platform




- coherent data replication    - automatic data persistence
- ACID transactions            - autom...
Terracotta Platform
Application                   Application                 Application




- coherent data replication ...
Terracotta Platform
Application         Application            Application




              Terracotta Server Instance

 ...
Terracotta Platform
Application         Application            Application




    Terracotta Server             Terracott...
Terracotta Platform
Application                  Application                    Application




Terracotta Server   Terrac...
Terracotta Platform
Application                  Application                    Application

   POJOs                     ...
Terracotta Platform
Application                  Application                    Application

Hibernate                    ...
TIMs
       Terracotta Platform
                  ------------

Application                  Application                  ...
TIMs
       Terracotta Platform
                  ------------

Application                  Application                  ...
Terracotta Use Cases
• Hibernate
• Spring
• EHCache
• Web Sessions
• Batch or Distributed Workload
• POJOs
Support...
Support...
• Community
 • ES
Support...
• Community
 • ES
• Commercial (24x7 SLA, official patches)
 • EX
 • FX
Terracotta for
  Hibernate
Features...
Features...
• Second-Level Cache
Features...
• Second-Level Cache
• Replicated, Coherent Cache
Features...
• Second-Level Cache
• Replicated, Coherent Cache
• Configurable settings at run-time
Features...
• Second-Level Cache
• Replicated, Coherent Cache
• Configurable settings at run-time
• Visual Profiling of Cach...
Terracotta for
Hibernate Architecture




         Standalone
        Architecture
Terracotta for
   Hibernate Architecture

 Standalone
Architecture




               Distributed
               Architect...
Performance
               100% Read      90 % Read
                0% Write      10% Write

                  2ms        ...
so, with a cache, you
        get...
so, with a cache, you
         get...
✓ Better performance
so, with a cache, you
          get...
✓ Better performance
✓ Better latency
so, with a cache, you
          get...
✓ Better performance
✓ Better latency
✓ Better throughput
so, with a cache, you
          get...
✓ Better performance
✓ Better latency
✓ Better throughput
✓ Better efficiency
so, with a cache, you
          get...
✓ Better performance
✓ Better latency
✓ Better throughput
✓ Better efficiency
✓ Lowe...
Your app needs...
Your app needs...
     a cache!
Installation and Setup
Step 1 - Download...
...and Install Terracotta
Step 2 - Copy the
 Hibernate JARs
Step 2 - Copy the
 Hibernate JARs
Step 3 - Update your
  Hibernate Config
Step 4 - Update and re-
 build your Application
Step 4 - Update and re-
 build your Application
Step 5 - Start a
Terracotta server
Step 6 - Start your
application server
Always start a
developer console!
DEMO!
Upcoming SlideShare
Loading in...5
×

Terracotta And Hibernate

2,426

Published on

Terracotta is a high performance open source Java clustering technology which includes native support via plug-ins to seamlessly integrate with applications based on Hibernate, EHCache, Spring and more. In this session, learn how to integrate Terracotta into your Hibernate application in just a few simple steps. Then visualize your application in real-time and tune it's performance using the Terracotta developer console, a sophisticated runtime visualization, profiling and debugging tool included with the core Terracotta kit.

Published in: Business, Sports, Career
0 Comments
7 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
2,426
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
209
Comments
0
Likes
7
Embeds 0
No embeds

No notes for slide
  • Transcript of "Terracotta And Hibernate"

    1. 1. Scaling Hibernate with Terracotta Taylor Gautier Code Camp, October 3, 2009
    2. 2. Agenda
    3. 3. Agenda • Caching 101
    4. 4. Agenda • Caching 101 • Intro to Terracotta
    5. 5. Agenda • Caching 101 • Intro to Terracotta • Installation and Setup
    6. 6. Agenda • Caching 101 • Intro to Terracotta • Installation and Setup • Demo
    7. 7. About me...
    8. 8. About me... • Java enthusiast since 1996
    9. 9. About me... • Java enthusiast since 1996 • Have built scalable systems since 1999
    10. 10. About me... • Java enthusiast since 1996 • Have built scalable systems since 1999 • Terracotta Product Manager 2006-2009
    11. 11. About me... • Java enthusiast since 1996 • Have built scalable systems since 1999 • Terracotta Product Manager 2006-2009 • Principal Architect - Grid Dynamics
    12. 12. About me... • Java enthusiast since 1996 • Have built scalable systems since 1999 • Terracotta Product Manager 2006-2009 • Principal Architect - Grid Dynamics • Technical Advisor - Terracotta
    13. 13. About me... • Java enthusiast since 1996 • Have built scalable systems since 1999 • Terracotta Product Manager 2006-2009 My Blog - java.think() • Principal Architect - Grid Dynamics http:// • Technical Advisor - Terracotta javathink.blogspot.com
    14. 14. Quick poll...
    15. 15. • How many have heard of Terracotta?
    16. 16. • How many have heard of Terracotta? • How many have downloaded it?
    17. 17. • How many have heard of Terracotta? • How many have downloaded it? • Anyone running in production?
    18. 18. Why are you here?
    19. 19. Your app needs... something
    20. 20. Your app needs... better latency
    21. 21. Your app needs... better throughput
    22. 22. Your app needs... better efficiency
    23. 23. Your app needs... to cost less
    24. 24. Let’s see if modern system architecture can help us...
    25. 25. Memory Hierarchy
    26. 26. Why a hierarchy?
    27. 27. Modern Hardware
    28. 28. Modern Hardware CPU Speed (2GHZ) 1 nanosecond (1x10 -9)
    29. 29. Modern Hardware CPU Speed (2GHZ) 1 nanosecond (1x10 -9) L1 Cache Access Time 2 nanoseconds (2x10 -9)
    30. 30. Modern Hardware CPU Speed (2GHZ) 1 nanosecond (1x10 -9) L1 Cache Access Time 2 nanoseconds (2x10 -9) L2 Cache Access Time 20 nanoseconds (20x10 -9)
    31. 31. Modern Hardware CPU Speed (2GHZ) 1 nanosecond (1x10 -9) L1 Cache Access Time 2 nanoseconds (2x10 -9) L2 Cache Access Time 20 nanoseconds (20x10 -9) Main Memory Access Time 60 nanoseconds (60x10 -9)
    32. 32. How common is this? Modern Hardware
    33. 33. How common is this? File-system
    34. 34. How common is this? Web Architecture
    35. 35. But not JEE?
    36. 36. But not JEE? Hibernate (Session)
    37. 37. But not JEE? Hibernate (Session) Hibernate Second Level Cache
    38. 38. Hibernate Architecture CPU Architecture
    39. 39. Hibernate Architecture CPU Architecture Hibernate Architecture
    40. 40. How to add a second level cache to your application?
    41. 41. Terracotta!
    42. 42. What is Terracotta?
    43. 43. IS IT...
    44. 44. A proprietary JVM?
    45. 45. Proprietary software?
    46. 46. Expensive?
    47. 47. Of course not!
    48. 48. Terracotta, is...
    49. 49. Terracotta, is... Open source
    50. 50. Terracotta, is... Open source High Performance Availability and Scalability
    51. 51. Terracotta, is... Open source High Performance Availability and Scalability For J2SE & J2EE
    52. 52. Terracotta, is... Open source High Performance Availability and Scalability For J2SE & J2EE Really fun!
    53. 53. Terracotta Platform Terracotta Platform (Server Array)
    54. 54. Terracotta Platform - coherent data replication - automatic data persistence - ACID transactions - automatic data routing - cluster coordination - visual profiling and debugging Terracotta Platform (Server Array)
    55. 55. Terracotta Platform Application Application Application - coherent data replication - automatic data persistence - ACID transactions - automatic data routing - cluster coordination - visual profiling and debugging Terracotta Platform (Server Array)
    56. 56. Terracotta Platform Application Application Application Terracotta Server Instance Terracotta Server Instance
    57. 57. Terracotta Platform Application Application Application Terracotta Server Terracotta Server Instance Instance Terracotta Server Terracotta Server Instance Instance
    58. 58. Terracotta Platform Application Application Application Terracotta Server Terracotta Server Terracotta Server Terracotta Server Instance Instance Instance Instance Terracotta Server Terracotta Server Terracotta Server Terracotta Server Instance Instance Instance Instance
    59. 59. Terracotta Platform Application Application Application POJOs POJOs POJOs Terracotta Server Terracotta Server Terracotta Server Terracotta Server Instance Instance Instance Instance Terracotta Server Terracotta Server Terracotta Server Terracotta Server Instance Instance Instance Instance
    60. 60. Terracotta Platform Application Application Application Hibernate Spring EHCache Terracotta Server Terracotta Server Terracotta Server Terracotta Server Instance Instance Instance Instance Terracotta Server Terracotta Server Terracotta Server Terracotta Server Instance Instance Instance Instance
    61. 61. TIMs Terracotta Platform ------------ Application Application Application Hibernate Spring EHCache Terracotta Server Terracotta Server Terracotta Server Terracotta Server Instance Instance Instance Instance Terracotta Server Terracotta Server Terracotta Server Terracotta Server Instance Instance Instance Instance
    62. 62. TIMs Terracotta Platform ------------ Application Application Application Hibernate Spring EHCache Hibernate TIM Spring TIMs EHCache TIM Terracotta Server Terracotta Server Terracotta Server Terracotta Server Instance Instance Instance Instance Terracotta Server Terracotta Server Terracotta Server Terracotta Server Instance Instance Instance Instance
    63. 63. Terracotta Use Cases • Hibernate • Spring • EHCache • Web Sessions • Batch or Distributed Workload • POJOs
    64. 64. Support...
    65. 65. Support... • Community • ES
    66. 66. Support... • Community • ES • Commercial (24x7 SLA, official patches) • EX • FX
    67. 67. Terracotta for Hibernate
    68. 68. Features...
    69. 69. Features... • Second-Level Cache
    70. 70. Features... • Second-Level Cache • Replicated, Coherent Cache
    71. 71. Features... • Second-Level Cache • Replicated, Coherent Cache • Configurable settings at run-time
    72. 72. Features... • Second-Level Cache • Replicated, Coherent Cache • Configurable settings at run-time • Visual Profiling of Cache and Performance
    73. 73. Terracotta for Hibernate Architecture Standalone Architecture
    74. 74. Terracotta for Hibernate Architecture Standalone Architecture Distributed Architecture
    75. 75. Performance 100% Read 90 % Read 0% Write 10% Write 2ms 7ms Terracotta 55k TPS 16k TPS 106ms 95ms MySQL alone 1,122 TPS 1,259 TPS PetClinic with 1,000,000 objects
    76. 76. so, with a cache, you get...
    77. 77. so, with a cache, you get... ✓ Better performance
    78. 78. so, with a cache, you get... ✓ Better performance ✓ Better latency
    79. 79. so, with a cache, you get... ✓ Better performance ✓ Better latency ✓ Better throughput
    80. 80. so, with a cache, you get... ✓ Better performance ✓ Better latency ✓ Better throughput ✓ Better efficiency
    81. 81. so, with a cache, you get... ✓ Better performance ✓ Better latency ✓ Better throughput ✓ Better efficiency ✓ Lower cost
    82. 82. Your app needs...
    83. 83. Your app needs... a cache!
    84. 84. Installation and Setup
    85. 85. Step 1 - Download...
    86. 86. ...and Install Terracotta
    87. 87. Step 2 - Copy the Hibernate JARs
    88. 88. Step 2 - Copy the Hibernate JARs
    89. 89. Step 3 - Update your Hibernate Config
    90. 90. Step 4 - Update and re- build your Application
    91. 91. Step 4 - Update and re- build your Application
    92. 92. Step 5 - Start a Terracotta server
    93. 93. Step 6 - Start your application server
    94. 94. Always start a developer console!
    95. 95. DEMO!
    1. A particular slide catching your eye?

      Clipping is a handy way to collect important slides you want to go back to later.

    ×